summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore6
-rw-r--r--conf/inter-server.conf3
-rw-r--r--conf/messages.conf3
-rw-r--r--conf/plugins.conf28
-rw-r--r--db/pre-re/skill_db.txt4
-rw-r--r--db/pre-re/skill_unit_db.txt10
-rw-r--r--db/re/skill_db.txt4
-rw-r--r--db/re/skill_unit_db.txt10
-rw-r--r--npc/quests/quests_13_1.txt88
-rw-r--r--src/char/char.c407
-rw-r--r--src/char/char.h1
-rw-r--r--src/char/int_auction.c30
-rw-r--r--src/char/int_guild.c4
-rw-r--r--src/char/int_homun.c14
-rw-r--r--src/char/int_mail.c18
-rw-r--r--src/char/int_quest.c24
-rw-r--r--src/char/inter.c2
-rw-r--r--src/char/inter.h3
-rw-r--r--src/common/HPM.c2
-rw-r--r--src/common/core.c4
-rw-r--r--src/common/db.c46
-rw-r--r--src/common/db.h88
-rw-r--r--src/common/sql.c145
-rw-r--r--src/common/sql.h192
-rw-r--r--src/common/timer.h4
-rw-r--r--src/config/const.h5
-rw-r--r--src/login/account_sql.c82
-rw-r--r--src/login/login.c6
-rw-r--r--src/map/atcommand.c367
-rw-r--r--src/map/battle.c174
-rw-r--r--src/map/battle.h23
-rw-r--r--src/map/battleground.c12
-rw-r--r--src/map/buyingstore.c20
-rw-r--r--src/map/chrif.c20
-rw-r--r--src/map/clif.c617
-rw-r--r--src/map/clif.h18
-rw-r--r--src/map/elemental.c2
-rw-r--r--src/map/guild.c32
-rw-r--r--src/map/homunculus.c4
-rw-r--r--src/map/instance.c10
-rw-r--r--src/map/intif.c26
-rw-r--r--src/map/itemdb.c19
-rw-r--r--src/map/log.c54
-rw-r--r--src/map/mail.c20
-rw-r--r--src/map/map.c160
-rw-r--r--src/map/map.h1
-rw-r--r--src/map/mapreg_sql.c18
-rw-r--r--src/map/mob.c42
-rw-r--r--src/map/npc.c60
-rw-r--r--src/map/packets.h75
-rw-r--r--src/map/party.c188
-rw-r--r--src/map/party.h28
-rw-r--r--src/map/path.c2
-rw-r--r--src/map/pc.c862
-rw-r--r--src/map/pc.h67
-rw-r--r--src/map/pc_groups.c13
-rw-r--r--src/map/pc_groups.h1
-rw-r--r--src/map/pet.c20
-rw-r--r--src/map/script.c803
-rw-r--r--src/map/script.h66
-rw-r--r--src/map/skill.c534
-rw-r--r--src/map/status.c255
-rw-r--r--src/map/storage.c28
-rw-r--r--src/map/trade.c28
-rw-r--r--src/map/unit.c52
-rw-r--r--src/map/vending.c20
66 files changed, 3263 insertions, 2711 deletions
diff --git a/.gitignore b/.gitignore
index c8a1e416e..3671563e0 100644
--- a/.gitignore
+++ b/.gitignore
@@ -27,6 +27,9 @@
/map-server
/mapcache
+# /plugins -- everything
+/plugins/
+
#OSX Xcode project user-sensitive-stuff
/Hercules
@@ -74,6 +77,9 @@
/src/tool/Makefile
/src/tool/obj_all
+# /src/plugins/
+/src/plugins/Makefile
+
# /tools/
/tools/convert
/tools/adduser
diff --git a/conf/inter-server.conf b/conf/inter-server.conf
index bf8d9e7a3..0e9808077 100644
--- a/conf/inter-server.conf
+++ b/conf/inter-server.conf
@@ -74,6 +74,9 @@ mysql_reconnect_count:1
// ALL MySQL Database Table names
+//Shared
+interreg_db: interreg
+
// Char Database Tables
char_db: char
hotkey_db: hotkey
diff --git a/conf/messages.conf b/conf/messages.conf
index e2886a57d..5bff9a5af 100644
--- a/conf/messages.conf
+++ b/conf/messages.conf
@@ -1505,5 +1505,8 @@
//src/map/pc.c::pc_isUseitem
1474: You cannot use this item while sitting
+//src/map/clif.c::clif_parse_NpcClicked
+1476: You cannot interact with NPCs while casting skills
+
//Custom translations
import: conf/import/msg_conf.txt
diff --git a/conf/plugins.conf b/conf/plugins.conf
index 5233c4ed4..7c4674edf 100644
--- a/conf/plugins.conf
+++ b/conf/plugins.conf
@@ -8,8 +8,30 @@
//=
//= http://hercules.ws/board/
//====================================================
-// == http://hercules.ws/board/topic/549-introducing-hercules-plugin-manager/
+//== Topic Discussion ================================
+//== http://hercules.ws/board/topic/549-introducing-hercules-plugin-manager/
+//====================================================
+//== Description =====================================
+//The plugin system allows you to create customized scripts
+//outside of the source. These scripts won't conflict with any
+//future source updates - think about it as a /conf/import/ version of the source.
+//====================================================
+
+/* --------------- Format ---------------
+After you have listed your plugin(s) in "quotations",
+you need to put in a comma, to separate the plugins.
+-----------------------------------------
+plugins_list: [
+ "example",
+ "other"
+]
+-----------------------------------------
+Please note that your scripts need to be saved
+in the .c (source code) extension and placed in the /src/plugin/ folder.
+-----------------------------------------
+*/
+
plugins_list:[
- //"sample"
+ //"sample",
//"other"
-] \ No newline at end of file
+]
diff --git a/db/pre-re/skill_db.txt b/db/pre-re/skill_db.txt
index df52ec439..3635bca65 100644
--- a/db/pre-re/skill_db.txt
+++ b/db/pre-re/skill_db.txt
@@ -9,8 +9,8 @@
// -2 - use endowed element, -3 - use random element.)
// 06 nk (skill damage properties):
// 0x01 - No damage skill
-// 0x02 - Has splash area
-// 0x04 - Damage should be split among targets
+// 0x02 - Has splash area (requires source modification)
+// 0x04 - Damage should be split among targets (requires 0x02 in order to work)
// 0x08 - Skill ignores caster's % damage cards (misc type always ignores)
// 0x10 - Skill ignores elemental adjustments
// 0x20 - Skill ignores target's defense (misc type always ignores)
diff --git a/db/pre-re/skill_unit_db.txt b/db/pre-re/skill_unit_db.txt
index c2de0782f..388bfd341 100644
--- a/db/pre-re/skill_unit_db.txt
+++ b/db/pre-re/skill_unit_db.txt
@@ -2,7 +2,7 @@
//
// layout = -1:special, 0:1*1, 1:3*3, 2:5*5, up to 5:11*11
// target = friend (party +guildmates +neutral players) / party / guild
-// ally (party +guildmates) / all / enemy
+// ally (party +guildmates) / all / sameguild (guild but no allies) / enemy
// flag 0x001(UF_DEFNOTENEMY) If 'defunit_not_enemy' is set, the target is changed to 'friend'
// 0x002(UF_NOREITERRATION) Spell cannot be stacked
// 0x004(UF_NOFOOTSET) Spell cannot be cast near/on targets
@@ -175,7 +175,7 @@
8409,0xef, , 0, 1, -1,friend,0x018 //EL_ZEPHYR
8412,0xf0, , 0, 1, -1,friend,0x018 //EL_POWER_OF_GAIA
-10006,0xc1, , 2, 0, -1,guild, 0x040 //GD_LEADERSHIP
-10007,0xc2, , 2, 0, -1,guild, 0x040 //GD_GLORYWOUNDS
-10008,0xc3, , 2, 0, -1,guild, 0x040 //GD_SOULCOLD
-10009,0xc4, , 2, 0, -1,guild, 0x040 //GD_HAWKEYES
+10006,0xc1, , 2, 0, -1,sameguild, 0x040 //GD_LEADERSHIP
+10007,0xc2, , 2, 0, -1,sameguild, 0x040 //GD_GLORYWOUNDS
+10008,0xc3, , 2, 0, -1,sameguild, 0x040 //GD_SOULCOLD
+10009,0xc4, , 2, 0, -1,sameguild, 0x040 //GD_HAWKEYES
diff --git a/db/re/skill_db.txt b/db/re/skill_db.txt
index 0406b6237..f6da92528 100644
--- a/db/re/skill_db.txt
+++ b/db/re/skill_db.txt
@@ -9,8 +9,8 @@
// -2 - use endowed element, -3 - use random element.)
// 06 nk (skill damage properties):
// 0x01 - No damage skill
-// 0x02 - Has splash area
-// 0x04 - Damage should be split among targets
+// 0x02 - Has splash area (requires source modification)
+// 0x04 - Damage should be split among targets (requires 0x02 in order to work)
// 0x08 - Skill ignores caster's % damage cards (misc type always ignores)
// 0x10 - Skill ignores elemental adjustments
// 0x20 - Skill ignores target's defense (misc type always ignores)
diff --git a/db/re/skill_unit_db.txt b/db/re/skill_unit_db.txt
index 3984ef64c..d8c19dbe9 100644
--- a/db/re/skill_unit_db.txt
+++ b/db/re/skill_unit_db.txt
@@ -2,7 +2,7 @@
//
// layout = -1:special, 0:1*1, 1:3*3, 2:5*5, up to 5:11*11
// target = friend (party +guildmates +neutral players) / party / guild
-// ally (party +guildmates) / all / enemy
+// ally (party +guildmates) / all / sameguild (guild but no allies) / enemy
// flag 0x001(UF_DEFNOTENEMY) If 'defunit_not_enemy' is set, the target is changed to 'friend'
// 0x002(UF_NOREITERRATION) Spell cannot be stacked
// 0x004(UF_NOFOOTSET) Spell cannot be cast near/on targets
@@ -177,7 +177,7 @@
8409,0xef, , 0, 1,1000,friend,0x018 //EL_ZEPHYR
8412,0xf0, , 0, 1, -1,friend,0x018 //EL_POWER_OF_GAIA
-10006,0xc1, , 2, 0, -1,guild, 0x040 //GD_LEADERSHIP
-10007,0xc2, , 2, 0, -1,guild, 0x040 //GD_GLORYWOUNDS
-10008,0xc3, , 2, 0, -1,guild, 0x040 //GD_SOULCOLD
-10009,0xc4, , 2, 0, -1,guild, 0x040 //GD_HAWKEYES
+10006,0xc1, , 2, 0, -1,sameguild, 0x040 //GD_LEADERSHIP
+10007,0xc2, , 2, 0, -1,sameguild, 0x040 //GD_GLORYWOUNDS
+10008,0xc3, , 2, 0, -1,sameguild, 0x040 //GD_SOULCOLD
+10009,0xc4, , 2, 0, -1,sameguild, 0x040 //GD_HAWKEYES
diff --git a/npc/quests/quests_13_1.txt b/npc/quests/quests_13_1.txt
index 78c843ae5..627688922 100644
--- a/npc/quests/quests_13_1.txt
+++ b/npc/quests/quests_13_1.txt
@@ -8877,7 +8877,7 @@ mid_campin,90,121,5 script Hibba Agip 459,{
mes "What is it?";
next;
mes "[Staff Officer Abidal]";
- mes "Err? Hey, aren't you that famous adventurer," + strcharinfo(0) + "? I've heard many good things about you.";
+ mes "Err? Hey, aren't you that famous adventurer, " + strcharinfo(0) + "? I've heard many good things about you.";
next;
mes "[Instructor Igrid]";
mes "I don't know what you're talking about. Boss, do you know this adventurer?";
@@ -8919,7 +8919,7 @@ mid_campin,90,121,5 script Hibba Agip 459,{
}
else if (ep13_1_edq == 2) {
mes "[Hibba Agip]";
- mes "Oh yes, right... You're" + strcharinfo(0) + ", right? Abidal has told me good things about you.";
+ mes "Oh yes, right... You're " + strcharinfo(0) + ", right? Abidal has told me good things about you.";
next;
mes "[Hibba Agip]";
mes "We're lucky to have you, my friend... I hope you're as good as the stories play you up to be.";
@@ -10195,7 +10195,7 @@ mid_camp,206,286,3 script Expedition Messenger 997,{
if ((ep13_1_edq == 3) && (countitem(11012) > 0)) {
mes "[Expedition Messenger]";
mes "Welcome, I've been waiting for you.";
- mes "You must be" + strcharinfo(0) + ". Nice to meet you.";
+ mes "You must be " + strcharinfo(0) + ". Nice to meet you.";
next;
mes "[Expedition Messenger]";
mes "Let me check something quicly. You received the report directly from the commander, didn't you? May I see it?";
@@ -10205,7 +10205,7 @@ mid_camp,206,286,3 script Expedition Messenger 997,{
mes ".........";
next;
mes "[Expedition Messenger]";
- mes "Excellent. Thank you. Then we'll go back to the mainland and let the leaders know that you,"+ strcharinfo(0) + ", have departed.";
+ mes "Excellent. Thank you. Then we'll go back to the mainland and let the leaders know that you, "+ strcharinfo(0) + ", have departed.";
next;
mes "[Expedition Messenger]";
mes "Guys, it's time to go.";
@@ -10255,7 +10255,7 @@ mid_camp,206,286,3 script Expedition Messenger 997,{
mes "Argh... You...";
next;
mes "[Expedition Messenger]";
- mes "*Cough* Oh, thank god!" + strcharinfo(0) + ", please take the report and run!";
+ mes "*Cough* Oh, thank god! " + strcharinfo(0) + ", please take the report and run!";
next;
mes "[???]";
mes "No... Noooo!";
@@ -10263,7 +10263,7 @@ mid_camp,206,286,3 script Expedition Messenger 997,{
specialeffect2 EF_SOULBREAKER;
specialeffect2 EF_SONICBLOWHIT;
mes "[Expedition Messenger]";
- mes "Argh..." + strcharinfo(0) + ", are you alright? The report... The report...";
+ mes "Argh... " + strcharinfo(0) + ", are you alright? The report... The report...";
next;
delitem 11012,1; //Expedition_Report
set ep13_1_edq,4;
@@ -10308,7 +10308,7 @@ mid_camp,206,286,3 script Expedition Messenger 997,{
mes "Argh... You...";
next;
mes "[Expedition Messenger]";
- mes "*Cough* Oh, thank god!" + strcharinfo(0) + ", please take the report and run!";
+ mes "*Cough* Oh, thank god! " + strcharinfo(0) + ", please take the report and run!";
next;
mes "[???]";
mes "No... Noooo!";
@@ -10316,7 +10316,7 @@ mid_camp,206,286,3 script Expedition Messenger 997,{
specialeffect2 EF_SOULBREAKER;
specialeffect2 EF_SONICBLOWHIT;
mes "[Expedition Messenger]";
- mes "Argh..." + strcharinfo(0) + ", are you alright? The report... The report...";
+ mes "Argh... " + strcharinfo(0) + ", are you alright? The report... The report...";
next;
mes "[Expedition Agent]";
mes "We lost the report. The pages are blowing away!";
@@ -10458,7 +10458,7 @@ man_fild01,315,95,3 script Expedition Scout#1 707,{
set .@ep13_search_lotto,rand(1,6);
if (.@ep13_search_lotto == 4) {
mes "[Expedition Scout]";
- mes "Oh, you must be" + strcharinfo(0) + ". I heard that you'll be delivering the report.";
+ mes "Oh, you must be " + strcharinfo(0) + ". I heard that you'll be delivering the report.";
next;
mes "[Expedition Scout]";
mes "Good news! I've found 5 pieces of paper that appear to be part of the report.";
@@ -10473,7 +10473,7 @@ man_fild01,315,95,3 script Expedition Scout#1 707,{
}
else if ((.@ep13_search_lotto == 1) || (.@ep13_search_lotto == 6)) {
mes "[Expedition Scout]";
- mes "Oh, you must be" + strcharinfo(0) + ". I heard that you'll be delivering the report.";
+ mes "Oh, you must be " + strcharinfo(0) + ". I heard that you'll be delivering the report.";
next;
mes "[Expedition Scout]";
mes "Good news! I've found 2 pieces of paper that appear to be part of the report.";
@@ -10488,7 +10488,7 @@ man_fild01,315,95,3 script Expedition Scout#1 707,{
}
else if (.@ep13_search_lotto == 3) {
mes "[Expedition Scout]";
- mes "Oh, you must be" + strcharinfo(0) + ". I heard that you'll be delivering the report.";
+ mes "Oh, you must be " + strcharinfo(0) + ". I heard that you'll be delivering the report.";
next;
mes "[Expedition Scout]";
mes "Good news! I've found 3 pieces of paper that appear to be part of the report.";
@@ -10503,7 +10503,7 @@ man_fild01,315,95,3 script Expedition Scout#1 707,{
}
else {
mes "[Expedition Scout]";
- mes "Oh, you must be" + strcharinfo(0) + ". I heard that you'll be delivering the report.";
+ mes "Oh, you must be " + strcharinfo(0) + ". I heard that you'll be delivering the report.";
next;
mes "[Expedition Scout]";
mes "I'm doing my best, but I haven't found any pages yet.";
@@ -10518,7 +10518,7 @@ man_fild01,315,95,3 script Expedition Scout#1 707,{
}
else if (((ep13_1_edq == 71) || (ep13_1_edq == 72)) && ((.@ep13_search_control == 0) || (.@ep13_search_control == 1))) {
mes "[Expedition Scout]";
- mes "Oh, you must be" + strcharinfo(0) + ". I heard that you'll be delivering the report.";
+ mes "Oh, you must be " + strcharinfo(0) + ". I heard that you'll be delivering the report.";
next;
mes "[Expedition Scout]";
mes "Searching for lost pages was tougher then I expected. Please come back later when I'm finished making one round.";
@@ -10528,7 +10528,7 @@ man_fild01,315,95,3 script Expedition Scout#1 707,{
set .@ep13_search_lotto,rand(1,6);
if (.@ep13_search_lotto == 4) {
mes "[Expedition Scout]";
- mes "Oh, you must be" + strcharinfo(0) + ". I heard that you'll be delivering the report.";
+ mes "Oh, you must be " + strcharinfo(0) + ". I heard that you'll be delivering the report.";
next;
mes "[Expedition Scout]";
mes "Good news! I've found 5 pieces of paper that appear to be part of the report.";
@@ -10542,7 +10542,7 @@ man_fild01,315,95,3 script Expedition Scout#1 707,{
}
else if ((.@ep13_search_lotto == 1) || (.@ep13_search_lotto == 6)) {
mes "[Expedition Scout]";
- mes "Oh, you must be" + strcharinfo(0) + ". I heard that you'll be delivering the report.";
+ mes "Oh, you must be " + strcharinfo(0) + ". I heard that you'll be delivering the report.";
next;
mes "[Expedition Scout]";
mes "Good news! I've found 2 pieces of paper that appear to be part of the report.";
@@ -10556,7 +10556,7 @@ man_fild01,315,95,3 script Expedition Scout#1 707,{
}
else if (.@ep13_search_lotto == 3) {
mes "[Expedition Scout]";
- mes "Oh, you must be" + strcharinfo(0) + ". I heard that you'll be delivering the report.";
+ mes "Oh, you must be " + strcharinfo(0) + ". I heard that you'll be delivering the report.";
next;
mes "[Expedition Scout]";
mes "Good news! I've found 3 pieces of paper that appear to be part of the report.";
@@ -10570,7 +10570,7 @@ man_fild01,315,95,3 script Expedition Scout#1 707,{
}
else {
mes "[Expedition Scout]";
- mes "Oh, you must be" + strcharinfo(0) + ". I heard that you'll be delivering the report.";
+ mes "Oh, you must be " + strcharinfo(0) + ". I heard that you'll be delivering the report.";
next;
mes "[Expedition Scout]";
mes "I'm doing my best, but I haven't found any pages yet.";
@@ -10633,7 +10633,7 @@ man_fild03,202,251,3 script Expedition Scout#2 707,{
set .@ep13_search_lotto,rand(1,6);
if (.@ep13_search_lotto == 4) {
mes "[Expedition Scout]";
- mes "Oh, you must be" + strcharinfo(0) + ". I heard that you'll be delivering the report.";
+ mes "Oh, you must be " + strcharinfo(0) + ". I heard that you'll be delivering the report.";
next;
mes "[Expedition Scout]";
mes "Good news! I've found 5 pieces of paper that appear to be part of the report.";
@@ -10648,7 +10648,7 @@ man_fild03,202,251,3 script Expedition Scout#2 707,{
}
else if ((.@ep13_search_lotto == 1) || (.@ep13_search_lotto == 6)) {
mes "[Expedition Scout]";
- mes "Oh, you must be" + strcharinfo(0) + ". I heard that you'll be delivering the report.";
+ mes "Oh, you must be " + strcharinfo(0) + ". I heard that you'll be delivering the report.";
next;
mes "[Expedition Scout]";
mes "Good news! I've found 2 piece of paper that appear to be part of the report.";
@@ -10663,7 +10663,7 @@ man_fild03,202,251,3 script Expedition Scout#2 707,{
}
else if (.@ep13_search_lotto == 3) {
mes "[Expedition Scout]";
- mes "Oh, you must be" + strcharinfo(0) + ". I heard that you'll be delivering the report.";
+ mes "Oh, you must be " + strcharinfo(0) + ". I heard that you'll be delivering the report.";
next;
mes "[Expedition Scout]";
mes "Good news! I've found 3 pieces of paper that appear to be part of the report.";
@@ -10678,7 +10678,7 @@ man_fild03,202,251,3 script Expedition Scout#2 707,{
}
else {
mes "[Expedition Scout]";
- mes "Oh, you must be" + strcharinfo(0) + ". I heard that you'll be delivering the report.";
+ mes "Oh, you must be " + strcharinfo(0) + ". I heard that you'll be delivering the report.";
next;
mes "[Expedition Scout]";
mes "I'm doing my best, but I haven't found any pages yet.";
@@ -10693,7 +10693,7 @@ man_fild03,202,251,3 script Expedition Scout#2 707,{
}
else if (((ep13_1_edq == 71) || (ep13_1_edq == 72)) && ((.@ep13_search_control == 0) || (.@ep13_search_control == 1))) {
mes "[Expedition Scout]";
- mes "Oh, you must be" + strcharinfo(0) + ". I heard that you'll be delivering the report.";
+ mes "Oh, you must be " + strcharinfo(0) + ". I heard that you'll be delivering the report.";
next;
mes "[Expedition Scout]";
mes "Searching for lost pages was tougher then I expected. Please come back later when I'm finished making one round.";
@@ -10703,7 +10703,7 @@ man_fild03,202,251,3 script Expedition Scout#2 707,{
set .@ep13_search_lotto,rand(1,6);
if (.@ep13_search_lotto == 4) {
mes "[Expedition Scout]";
- mes "Oh, you must be" + strcharinfo(0) + ". I heard that you'll be delivering the report.";
+ mes "Oh, you must be " + strcharinfo(0) + ". I heard that you'll be delivering the report.";
next;
mes "[Expedition Scout]";
mes "Good news! I've found 5 pieces of paper that appear to be part of the report.";
@@ -10717,7 +10717,7 @@ man_fild03,202,251,3 script Expedition Scout#2 707,{
}
else if ((.@ep13_search_lotto == 1) || (.@ep13_search_lotto == 6)) {
mes "[Expedition Scout]";
- mes "Oh, you must be" + strcharinfo(0) + ". I heard that you'll be delivering the report.";
+ mes "Oh, you must be " + strcharinfo(0) + ". I heard that you'll be delivering the report.";
next;
mes "[Expedition Scout]";
mes "Good news! I've found 2 pieces of paper that appear to be part of the report.";
@@ -10731,7 +10731,7 @@ man_fild03,202,251,3 script Expedition Scout#2 707,{
}
else if (.@ep13_search_lotto == 3) {
mes "[Expedition Scout]";
- mes "Oh, you must be" + strcharinfo(0) + ". I heard that you'll be delivering the report.";
+ mes "Oh, you must be " + strcharinfo(0) + ". I heard that you'll be delivering the report.";
next;
mes "[Expedition Scout]";
mes "Good news! I've found 3 pieces of paper that appear to be part of the report.";
@@ -10745,7 +10745,7 @@ man_fild03,202,251,3 script Expedition Scout#2 707,{
}
else {
mes "[Expedition Scout]";
- mes "Oh, you must be" + strcharinfo(0) + ". I heard that you'll be delivering the report.";
+ mes "Oh, you must be " + strcharinfo(0) + ". I heard that you'll be delivering the report.";
next;
mes "[Expedition Scout]";
mes "I'm doing my best, but I haven't found any pages yet.";
@@ -10798,7 +10798,7 @@ spl_fild02,295,368,3 script Expedition Scout#3 707,{
set .@ep13_search_lotto,rand(1,6);
if (.@ep13_search_lotto == 4) {
mes "[Expedition Scout]";
- mes "Oh, you must be" + strcharinfo(0) + ". I heard that you'll be delivering the report.";
+ mes "Oh, you must be " + strcharinfo(0) + ". I heard that you'll be delivering the report.";
next;
mes "[Expedition Scout]";
mes "Good news! I've found 5 pieces of paper that appear to be part of the report.";
@@ -10813,7 +10813,7 @@ spl_fild02,295,368,3 script Expedition Scout#3 707,{
}
else if ((.@ep13_search_lotto == 1) || (.@ep13_search_lotto == 6)) {
mes "[Expedition Scout]";
- mes "Oh, you must be" + strcharinfo(0) + ". I heard that you'll be delivering the report.";
+ mes "Oh, you must be " + strcharinfo(0) + ". I heard that you'll be delivering the report.";
next;
mes "[Expedition Scout]";
mes "Good news! I've found 2 pieces of paper that appear to be part of the report.";
@@ -10828,7 +10828,7 @@ spl_fild02,295,368,3 script Expedition Scout#3 707,{
}
else if (.@ep13_search_lotto == 3) {
mes "[Expedition Scout]";
- mes "Oh, you must be" + strcharinfo(0) + ". I heard that you'll be delivering the report.";
+ mes "Oh, you must be " + strcharinfo(0) + ". I heard that you'll be delivering the report.";
next;
mes "[Expedition Scout]";
mes "Good news! I've found 3 pieces of paper that appear to be part of the report.";
@@ -10843,7 +10843,7 @@ spl_fild02,295,368,3 script Expedition Scout#3 707,{
}
else {
mes "[Expedition Scout]";
- mes "Oh, you must be" + strcharinfo(0) + ". I heard that you'll be delivering the report.";
+ mes "Oh, you must be " + strcharinfo(0) + ". I heard that you'll be delivering the report.";
next;
mes "[Expedition Scout]";
mes "I'm doing my best, but I haven't found any pages yet.";
@@ -10858,7 +10858,7 @@ spl_fild02,295,368,3 script Expedition Scout#3 707,{
}
else if (((ep13_1_edq == 71) || (ep13_1_edq == 72)) && ((.@ep13_search_control == 0) || (.@ep13_search_control == 1))) {
mes "[Expedition Scout]";
- mes "Oh, you must be" + strcharinfo(0) + ". I heard that you'll be delivering the report.";
+ mes "Oh, you must be " + strcharinfo(0) + ". I heard that you'll be delivering the report.";
next;
mes "[Expedition Scout]";
mes "Searching for lost pages was tougher then I expected. Please come back later when I'm finished making one round.";
@@ -10868,7 +10868,7 @@ spl_fild02,295,368,3 script Expedition Scout#3 707,{
set .@ep13_search_lotto,rand(1,6);
if (.@ep13_search_lotto == 4) {
mes "[Expedition Scout]";
- mes "Oh, you must be" + strcharinfo(0) + ". I heard that you'll be delivering the report.";
+ mes "Oh, you must be " + strcharinfo(0) + ". I heard that you'll be delivering the report.";
next;
mes "[Expedition Scout]";
mes "Good news! I've found 5 pieces of paper that appear to be part of the report.";
@@ -10882,7 +10882,7 @@ spl_fild02,295,368,3 script Expedition Scout#3 707,{
}
else if ((.@ep13_search_lotto == 1) || (.@ep13_search_lotto == 6)) {
mes "[Expedition Scout]";
- mes "Oh, you must be" + strcharinfo(0) + ". I heard that you'll be delivering the report.";
+ mes "Oh, you must be " + strcharinfo(0) + ". I heard that you'll be delivering the report.";
next;
mes "[Expedition Scout]";
mes "Good news! I've found 2 piece of paper that appear to be part of the report.";
@@ -10896,7 +10896,7 @@ spl_fild02,295,368,3 script Expedition Scout#3 707,{
}
else if (.@ep13_search_lotto == 3) {
mes "[Expedition Scout]";
- mes "Oh, you must be" + strcharinfo(0) + ". I heard that you'll be delivering the report.";
+ mes "Oh, you must be " + strcharinfo(0) + ". I heard that you'll be delivering the report.";
next;
mes "[Expedition Scout]";
mes "Good news! I've found 3 pieces of paper that appear to be part of the report.";
@@ -10910,7 +10910,7 @@ spl_fild02,295,368,3 script Expedition Scout#3 707,{
}
else {
mes "[Expedition Scout]";
- mes "Oh, you must be" + strcharinfo(0) + ". I heard that you'll be delivering the report.";
+ mes "Oh, you must be " + strcharinfo(0) + ". I heard that you'll be delivering the report.";
next;
mes "[Expedition Scout]";
mes "I'm doing my best, but I haven't found any pages yet.";
@@ -10973,7 +10973,7 @@ spl_fild03,172,71,3 script Expedition Scout#4 707,{
set .@ep13_search_lotto,rand(1,6);
if (.@ep13_search_lotto == 4) {
mes "[Expedition Scout]";
- mes "Oh, you must be" + strcharinfo(0) + ". I heard that you'll be delivering the report.";
+ mes "Oh, you must be " + strcharinfo(0) + ". I heard that you'll be delivering the report.";
next;
mes "[Expedition Scout]";
mes "Good news! I've found 5 pieces of paper that appear to be part of the report.";
@@ -10988,7 +10988,7 @@ spl_fild03,172,71,3 script Expedition Scout#4 707,{
}
else if ((.@ep13_search_lotto == 1) || (.@ep13_search_lotto == 6)) {
mes "[Expedition Scout]";
- mes "Oh, you must be" + strcharinfo(0) + ". I heard that you'll be delivering the report.";
+ mes "Oh, you must be " + strcharinfo(0) + ". I heard that you'll be delivering the report.";
next;
mes "[Expedition Scout]";
mes "Good news! I've found 2 pieces of paper that appear to be part of the report.";
@@ -11003,7 +11003,7 @@ spl_fild03,172,71,3 script Expedition Scout#4 707,{
}
else if (.@ep13_search_lotto == 3) {
mes "[Expedition Scout]";
- mes "Oh, you must be" + strcharinfo(0) + ". I heard that you'll be delivering the report.";
+ mes "Oh, you must be " + strcharinfo(0) + ". I heard that you'll be delivering the report.";
next;
mes "[Expedition Scout]";
mes "Good news! I've found 3 pieces of paper that appear to be part of the report.";
@@ -11018,7 +11018,7 @@ spl_fild03,172,71,3 script Expedition Scout#4 707,{
}
else {
mes "[Expedition Scout]";
- mes "Oh, you must be" + strcharinfo(0) + ". I heard that you'll be delivering the report.";
+ mes "Oh, you must be " + strcharinfo(0) + ". I heard that you'll be delivering the report.";
next;
mes "[Expedition Scout]";
mes "I'm doing my best, but I haven't found any pages yet.";
@@ -11033,7 +11033,7 @@ spl_fild03,172,71,3 script Expedition Scout#4 707,{
}
else if (((ep13_1_edq == 71) || (ep13_1_edq == 72)) && ((.@ep13_search_control == 0) || (.@ep13_search_control == 1))) {
mes "[Expedition Scout]";
- mes "Oh, you must be" + strcharinfo(0) + ". I heard that you'll be delivering the report.";
+ mes "Oh, you must be " + strcharinfo(0) + ". I heard that you'll be delivering the report.";
next;
mes "[Expedition Scout]";
mes "Searching for lost pages was tougher then I expected. Please come back later when I'm finished making one round.";
@@ -11043,7 +11043,7 @@ spl_fild03,172,71,3 script Expedition Scout#4 707,{
set .@ep13_search_lotto,rand(1,6);
if (.@ep13_search_lotto == 4) {
mes "[Expedition Scout]";
- mes "Oh, you must be" + strcharinfo(0) + ". I heard that you'll be delivering the report.";
+ mes "Oh, you must be " + strcharinfo(0) + ". I heard that you'll be delivering the report.";
next;
mes "[Expedition Scout]";
mes "Good news! I've found 5 pieces of paper that appear to be part of the report.";
@@ -11057,7 +11057,7 @@ spl_fild03,172,71,3 script Expedition Scout#4 707,{
}
else if ((.@ep13_search_lotto == 1) || (.@ep13_search_lotto == 6)) {
mes "[Expedition Scout]";
- mes "Oh, you must be" + strcharinfo(0) + ". I heard that you'll be delivering the report.";
+ mes "Oh, you must be " + strcharinfo(0) + ". I heard that you'll be delivering the report.";
next;
mes "[Expedition Scout]";
mes "Good news! I've found 2 pieces of paper that appear to be part of the report.";
@@ -11071,7 +11071,7 @@ spl_fild03,172,71,3 script Expedition Scout#4 707,{
}
else if (.@ep13_search_lotto == 3) {
mes "[Expedition Scout]";
- mes "Oh, you must be" + strcharinfo(0) + ". I heard that you'll be delivering the report.";
+ mes "Oh, you must be " + strcharinfo(0) + ". I heard that you'll be delivering the report.";
next;
mes "[Expedition Scout]";
mes "Good news! I've found 3 pieces of paper that appear to be part of the report.";
@@ -11085,7 +11085,7 @@ spl_fild03,172,71,3 script Expedition Scout#4 707,{
}
else {
mes "[Expedition Scout]";
- mes "Oh, you must be" + strcharinfo(0) + ". I heard that you'll be delivering the report.";
+ mes "Oh, you must be " + strcharinfo(0) + ". I heard that you'll be delivering the report.";
next;
mes "[Expedition Scout]";
mes "I'm doing my best, but I haven't found any pages yet.";
diff --git a/src/char/char.c b/src/char/char.c
index 3083876ab..f889c1a25 100644
--- a/src/char/char.c
+++ b/src/char/char.c
@@ -66,6 +66,7 @@ char skill_homunculus_db[256] = "skill_homunculus";
char mercenary_db[256] = "mercenary";
char mercenary_owner_db[256] = "mercenary_owner";
char ragsrvinfo_db[256] = "ragsrvinfo";
+char interreg_db[32] = "interreg";
// show loading/saving messages
int save_log = 1;
@@ -188,7 +189,7 @@ static DBData create_online_char_data(DBKey key, va_list args)
character->pincode_enable = -1;
character->fd = -1;
character->waiting_disconnect = INVALID_TIMER;
- return iDB->ptr2data(character);
+ return DB->ptr2data(character);
}
void set_char_charselect(int account_id)
@@ -322,7 +323,7 @@ void set_char_offline(int char_id, int account_id)
*/
static int char_db_setoffline(DBKey key, DBData *data, va_list ap)
{
- struct online_char_data* character = (struct online_char_data*)iDB->data2ptr(data);
+ struct online_char_data* character = (struct online_char_data*)DB->data2ptr(data);
int server = va_arg(ap, int);
if (server == -1) {
character->char_id = -1;
@@ -341,7 +342,7 @@ static int char_db_setoffline(DBKey key, DBData *data, va_list ap)
*/
static int char_db_kickoffline(DBKey key, DBData *data, va_list ap)
{
- struct online_char_data* character = (struct online_char_data*)iDB->data2ptr(data);
+ struct online_char_data* character = (struct online_char_data*)DB->data2ptr(data);
int server_id = va_arg(ap, int);
if (server_id > -1 && character->server != server_id)
@@ -393,7 +394,7 @@ static DBData create_charstatus(DBKey key, va_list args)
struct mmo_charstatus *cp;
cp = (struct mmo_charstatus *) aCalloc(1,sizeof(struct mmo_charstatus));
cp->char_id = key.i;
- return iDB->ptr2data(cp);
+ return DB->ptr2data(cp);
}
int inventory_to_sql(const struct item items[], int max, int id);
@@ -713,31 +714,31 @@ int memitemdata_to_sql(const struct item items[], int max, int id, int tableswit
StrBuf->Printf(&buf, ", `card%d`", j);
StrBuf->Printf(&buf, " FROM `%s` WHERE `%s`='%d'", tablename, selectoption, id);
- stmt = SqlStmt_Malloc(sql_handle);
- if( SQL_ERROR == SqlStmt_PrepareStr(stmt, StrBuf->Value(&buf))
- || SQL_ERROR == SqlStmt_Execute(stmt) )
+ stmt = SQL->StmtMalloc(sql_handle);
+ if( SQL_ERROR == SQL->StmtPrepareStr(stmt, StrBuf->Value(&buf))
+ || SQL_ERROR == SQL->StmtExecute(stmt) )
{
SqlStmt_ShowDebug(stmt);
- SqlStmt_Free(stmt);
+ SQL->StmtFree(stmt);
StrBuf->Destroy(&buf);
return 1;
}
- SqlStmt_BindColumn(stmt, 0, SQLDT_INT, &item.id, 0, NULL, NULL);
- SqlStmt_BindColumn(stmt, 1, SQLDT_SHORT, &item.nameid, 0, NULL, NULL);
- SqlStmt_BindColumn(stmt, 2, SQLDT_SHORT, &item.amount, 0, NULL, NULL);
- SqlStmt_BindColumn(stmt, 3, SQLDT_USHORT, &item.equip, 0, NULL, NULL);
- SqlStmt_BindColumn(stmt, 4, SQLDT_CHAR, &item.identify, 0, NULL, NULL);
- SqlStmt_BindColumn(stmt, 5, SQLDT_CHAR, &item.refine, 0, NULL, NULL);
- SqlStmt_BindColumn(stmt, 6, SQLDT_CHAR, &item.attribute, 0, NULL, NULL);
- SqlStmt_BindColumn(stmt, 7, SQLDT_UINT, &item.expire_time, 0, NULL, NULL);
+ SQL->StmtBindColumn(stmt, 0, SQLDT_INT, &item.id, 0, NULL, NULL);
+ SQL->StmtBindColumn(stmt, 1, SQLDT_SHORT, &item.nameid, 0, NULL, NULL);
+ SQL->StmtBindColumn(stmt, 2, SQLDT_SHORT, &item.amount, 0, NULL, NULL);
+ SQL->StmtBindColumn(stmt, 3, SQLDT_USHORT, &item.equip, 0, NULL, NULL);
+ SQL->StmtBindColumn(stmt, 4, SQLDT_CHAR, &item.identify, 0, NULL, NULL);
+ SQL->StmtBindColumn(stmt, 5, SQLDT_CHAR, &item.refine, 0, NULL, NULL);
+ SQL->StmtBindColumn(stmt, 6, SQLDT_CHAR, &item.attribute, 0, NULL, NULL);
+ SQL->StmtBindColumn(stmt, 7, SQLDT_UINT, &item.expire_time, 0, NULL, NULL);
for( j = 0; j < MAX_SLOTS; ++j )
- SqlStmt_BindColumn(stmt, 8+j, SQLDT_SHORT, &item.card[j], 0, NULL, NULL);
+ SQL->StmtBindColumn(stmt, 8+j, SQLDT_SHORT, &item.card[j], 0, NULL, NULL);
// bit array indicating which inventory items have already been matched
flag = (bool*) aCalloc(max, sizeof(bool));
- while( SQL_SUCCESS == SqlStmt_NextRow(stmt) )
+ while( SQL_SUCCESS == SQL->StmtNextRow(stmt) )
{
found = false;
// search for the presence of the item in the char's inventory
@@ -791,7 +792,7 @@ int memitemdata_to_sql(const struct item items[], int max, int id, int tableswit
}
}
}
- SqlStmt_Free(stmt);
+ SQL->StmtFree(stmt);
StrBuf->Clear(&buf);
StrBuf->Printf(&buf, "INSERT INTO `%s`(`%s`, `nameid`, `amount`, `equip`, `identify`, `refine`, `attribute`, `expire_time`, `unique_id`", tablename, selectoption);
@@ -857,32 +858,32 @@ int inventory_to_sql(const struct item items[], int max, int id) {
StrBuf->Printf(&buf, ", `card%d`", j);
StrBuf->Printf(&buf, " FROM `%s` WHERE `char_id`='%d'", inventory_db, id);
- stmt = SqlStmt_Malloc(sql_handle);
- if( SQL_ERROR == SqlStmt_PrepareStr(stmt, StrBuf->Value(&buf))
- || SQL_ERROR == SqlStmt_Execute(stmt) )
+ stmt = SQL->StmtMalloc(sql_handle);
+ if( SQL_ERROR == SQL->StmtPrepareStr(stmt, StrBuf->Value(&buf))
+ || SQL_ERROR == SQL->StmtExecute(stmt) )
{
SqlStmt_ShowDebug(stmt);
- SqlStmt_Free(stmt);
+ SQL->StmtFree(stmt);
StrBuf->Destroy(&buf);
return 1;
}
- SqlStmt_BindColumn(stmt, 0, SQLDT_INT, &item.id, 0, NULL, NULL);
- SqlStmt_BindColumn(stmt, 1, SQLDT_SHORT, &item.nameid, 0, NULL, NULL);
- SqlStmt_BindColumn(stmt, 2, SQLDT_SHORT, &item.amount, 0, NULL, NULL);
- SqlStmt_BindColumn(stmt, 3, SQLDT_USHORT, &item.equip, 0, NULL, NULL);
- SqlStmt_BindColumn(stmt, 4, SQLDT_CHAR, &item.identify, 0, NULL, NULL);
- SqlStmt_BindColumn(stmt, 5, SQLDT_CHAR, &item.refine, 0, NULL, NULL);
- SqlStmt_BindColumn(stmt, 6, SQLDT_CHAR, &item.attribute, 0, NULL, NULL);
- SqlStmt_BindColumn(stmt, 7, SQLDT_UINT, &item.expire_time, 0, NULL, NULL);
- SqlStmt_BindColumn(stmt, 8, SQLDT_CHAR, &item.favorite, 0, NULL, NULL);
+ SQL->StmtBindColumn(stmt, 0, SQLDT_INT, &item.id, 0, NULL, NULL);
+ SQL->StmtBindColumn(stmt, 1, SQLDT_SHORT, &item.nameid, 0, NULL, NULL);
+ SQL->StmtBindColumn(stmt, 2, SQLDT_SHORT, &item.amount, 0, NULL, NULL);
+ SQL->StmtBindColumn(stmt, 3, SQLDT_USHORT, &item.equip, 0, NULL, NULL);
+ SQL->StmtBindColumn(stmt, 4, SQLDT_CHAR, &item.identify, 0, NULL, NULL);
+ SQL->StmtBindColumn(stmt, 5, SQLDT_CHAR, &item.refine, 0, NULL, NULL);
+ SQL->StmtBindColumn(stmt, 6, SQLDT_CHAR, &item.attribute, 0, NULL, NULL);
+ SQL->StmtBindColumn(stmt, 7, SQLDT_UINT, &item.expire_time, 0, NULL, NULL);
+ SQL->StmtBindColumn(stmt, 8, SQLDT_CHAR, &item.favorite, 0, NULL, NULL);
for( j = 0; j < MAX_SLOTS; ++j )
- SqlStmt_BindColumn(stmt, 9+j, SQLDT_SHORT, &item.card[j], 0, NULL, NULL);
+ SQL->StmtBindColumn(stmt, 9+j, SQLDT_SHORT, &item.card[j], 0, NULL, NULL);
// bit array indicating which inventory items have already been matched
flag = (bool*) aCalloc(max, sizeof(bool));
- while( SQL_SUCCESS == SqlStmt_NextRow(stmt) ) {
+ while( SQL_SUCCESS == SQL->StmtNextRow(stmt) ) {
found = false;
// search for the presence of the item in the char's inventory
for( i = 0; i < max; ++i ) {
@@ -931,7 +932,7 @@ int inventory_to_sql(const struct item items[], int max, int id) {
}
}
}
- SqlStmt_Free(stmt);
+ SQL->StmtFree(stmt);
StrBuf->Clear(&buf);
StrBuf->Printf(&buf, "INSERT INTO `%s` (`char_id`, `nameid`, `amount`, `equip`, `identify`, `refine`, `attribute`, `expire_time`, `favorite`, `unique_id`", inventory_db);
@@ -984,7 +985,7 @@ int mmo_chars_fromsql(struct char_session_data* sd, uint8* buf)
int j = 0, i;
char last_map[MAP_NAME_LENGTH_EXT];
- stmt = SqlStmt_Malloc(sql_handle);
+ stmt = SQL->StmtMalloc(sql_handle);
if( stmt == NULL ) {
SqlStmt_ShowDebug(stmt);
return 0;
@@ -995,59 +996,59 @@ int mmo_chars_fromsql(struct char_session_data* sd, uint8* buf)
sd->found_char[i] = -1;
// read char data
- if( SQL_ERROR == SqlStmt_Prepare(stmt, "SELECT "
+ if( SQL_ERROR == SQL->StmtPrepare(stmt, "SELECT "
"`char_id`,`char_num`,`name`,`class`,`base_level`,`job_level`,`base_exp`,`job_exp`,`zeny`,"
"`str`,`agi`,`vit`,`int`,`dex`,`luk`,`max_hp`,`hp`,`max_sp`,`sp`,"
"`status_point`,`skill_point`,`option`,`karma`,`manner`,`hair`,`hair_color`,"
"`clothes_color`,`weapon`,`shield`,`head_top`,`head_mid`,`head_bottom`,`last_map`,`rename`,`delete_date`,"
"`robe`,`slotchange`"
" FROM `%s` WHERE `account_id`='%d' AND `char_num` < '%d'", char_db, sd->account_id, MAX_CHARS)
- || SQL_ERROR == SqlStmt_Execute(stmt)
- || SQL_ERROR == SqlStmt_BindColumn(stmt, 0, SQLDT_INT, &p.char_id, 0, NULL, NULL)
- || SQL_ERROR == SqlStmt_BindColumn(stmt, 1, SQLDT_UCHAR, &p.slot, 0, NULL, NULL)
- || SQL_ERROR == SqlStmt_BindColumn(stmt, 2, SQLDT_STRING, &p.name, sizeof(p.name), NULL, NULL)
- || SQL_ERROR == SqlStmt_BindColumn(stmt, 3, SQLDT_SHORT, &p.class_, 0, NULL, NULL)
- || SQL_ERROR == SqlStmt_BindColumn(stmt, 4, SQLDT_UINT, &p.base_level, 0, NULL, NULL)
- || SQL_ERROR == SqlStmt_BindColumn(stmt, 5, SQLDT_UINT, &p.job_level, 0, NULL, NULL)
- || SQL_ERROR == SqlStmt_BindColumn(stmt, 6, SQLDT_UINT, &p.base_exp, 0, NULL, NULL)
- || SQL_ERROR == SqlStmt_BindColumn(stmt, 7, SQLDT_UINT, &p.job_exp, 0, NULL, NULL)
- || SQL_ERROR == SqlStmt_BindColumn(stmt, 8, SQLDT_INT, &p.zeny, 0, NULL, NULL)
- || SQL_ERROR == SqlStmt_BindColumn(stmt, 9, SQLDT_SHORT, &p.str, 0, NULL, NULL)
- || SQL_ERROR == SqlStmt_BindColumn(stmt, 10, SQLDT_SHORT, &p.agi, 0, NULL, NULL)
- || SQL_ERROR == SqlStmt_BindColumn(stmt, 11, SQLDT_SHORT, &p.vit, 0, NULL, NULL)
- || SQL_ERROR == SqlStmt_BindColumn(stmt, 12, SQLDT_SHORT, &p.int_, 0, NULL, NULL)
- || SQL_ERROR == SqlStmt_BindColumn(stmt, 13, SQLDT_SHORT, &p.dex, 0, NULL, NULL)
- || SQL_ERROR == SqlStmt_BindColumn(stmt, 14, SQLDT_SHORT, &p.luk, 0, NULL, NULL)
- || SQL_ERROR == SqlStmt_BindColumn(stmt, 15, SQLDT_INT, &p.max_hp, 0, NULL, NULL)
- || SQL_ERROR == SqlStmt_BindColumn(stmt, 16, SQLDT_INT, &p.hp, 0, NULL, NULL)
- || SQL_ERROR == SqlStmt_BindColumn(stmt, 17, SQLDT_INT, &p.max_sp, 0, NULL, NULL)
- || SQL_ERROR == SqlStmt_BindColumn(stmt, 18, SQLDT_INT, &p.sp, 0, NULL, NULL)
- || SQL_ERROR == SqlStmt_BindColumn(stmt, 19, SQLDT_UINT, &p.status_point, 0, NULL, NULL)
- || SQL_ERROR == SqlStmt_BindColumn(stmt, 20, SQLDT_UINT, &p.skill_point, 0, NULL, NULL)
- || SQL_ERROR == SqlStmt_BindColumn(stmt, 21, SQLDT_UINT, &p.option, 0, NULL, NULL)
- || SQL_ERROR == SqlStmt_BindColumn(stmt, 22, SQLDT_UCHAR, &p.karma, 0, NULL, NULL)
- || SQL_ERROR == SqlStmt_BindColumn(stmt, 23, SQLDT_SHORT, &p.manner, 0, NULL, NULL)
- || SQL_ERROR == SqlStmt_BindColumn(stmt, 24, SQLDT_SHORT, &p.hair, 0, NULL, NULL)
- || SQL_ERROR == SqlStmt_BindColumn(stmt, 25, SQLDT_SHORT, &p.hair_color, 0, NULL, NULL)
- || SQL_ERROR == SqlStmt_BindColumn(stmt, 26, SQLDT_SHORT, &p.clothes_color, 0, NULL, NULL)
- || SQL_ERROR == SqlStmt_BindColumn(stmt, 27, SQLDT_SHORT, &p.weapon, 0, NULL, NULL)
- || SQL_ERROR == SqlStmt_BindColumn(stmt, 28, SQLDT_SHORT, &p.shield, 0, NULL, NULL)
- || SQL_ERROR == SqlStmt_BindColumn(stmt, 29, SQLDT_SHORT, &p.head_top, 0, NULL, NULL)
- || SQL_ERROR == SqlStmt_BindColumn(stmt, 30, SQLDT_SHORT, &p.head_mid, 0, NULL, NULL)
- || SQL_ERROR == SqlStmt_BindColumn(stmt, 31, SQLDT_SHORT, &p.head_bottom, 0, NULL, NULL)
- || SQL_ERROR == SqlStmt_BindColumn(stmt, 32, SQLDT_STRING, &last_map, sizeof(last_map), NULL, NULL)
- || SQL_ERROR == SqlStmt_BindColumn(stmt, 33, SQLDT_USHORT, &p.rename, 0, NULL, NULL)
- || SQL_ERROR == SqlStmt_BindColumn(stmt, 34, SQLDT_UINT32, &p.delete_date, 0, NULL, NULL)
- || SQL_ERROR == SqlStmt_BindColumn(stmt, 35, SQLDT_SHORT, &p.robe, 0, NULL, NULL)
- || SQL_ERROR == SqlStmt_BindColumn(stmt, 36, SQLDT_USHORT, &p.slotchange, 0, NULL, NULL)
+ || SQL_ERROR == SQL->StmtExecute(stmt)
+ || SQL_ERROR == SQL->StmtBindColumn(stmt, 0, SQLDT_INT, &p.char_id, 0, NULL, NULL)
+ || SQL_ERROR == SQL->StmtBindColumn(stmt, 1, SQLDT_UCHAR, &p.slot, 0, NULL, NULL)
+ || SQL_ERROR == SQL->StmtBindColumn(stmt, 2, SQLDT_STRING, &p.name, sizeof(p.name), NULL, NULL)
+ || SQL_ERROR == SQL->StmtBindColumn(stmt, 3, SQLDT_SHORT, &p.class_, 0, NULL, NULL)
+ || SQL_ERROR == SQL->StmtBindColumn(stmt, 4, SQLDT_UINT, &p.base_level, 0, NULL, NULL)
+ || SQL_ERROR == SQL->StmtBindColumn(stmt, 5, SQLDT_UINT, &p.job_level, 0, NULL, NULL)
+ || SQL_ERROR == SQL->StmtBindColumn(stmt, 6, SQLDT_UINT, &p.base_exp, 0, NULL, NULL)
+ || SQL_ERROR == SQL->StmtBindColumn(stmt, 7, SQLDT_UINT, &p.job_exp, 0, NULL, NULL)
+ || SQL_ERROR == SQL->StmtBindColumn(stmt, 8, SQLDT_INT, &p.zeny, 0, NULL, NULL)
+ || SQL_ERROR == SQL->StmtBindColumn(stmt, 9, SQLDT_SHORT, &p.str, 0, NULL, NULL)
+ || SQL_ERROR == SQL->StmtBindColumn(stmt, 10, SQLDT_SHORT, &p.agi, 0, NULL, NULL)
+ || SQL_ERROR == SQL->StmtBindColumn(stmt, 11, SQLDT_SHORT, &p.vit, 0, NULL, NULL)
+ || SQL_ERROR == SQL->StmtBindColumn(stmt, 12, SQLDT_SHORT, &p.int_, 0, NULL, NULL)
+ || SQL_ERROR == SQL->StmtBindColumn(stmt, 13, SQLDT_SHORT, &p.dex, 0, NULL, NULL)
+ || SQL_ERROR == SQL->StmtBindColumn(stmt, 14, SQLDT_SHORT, &p.luk, 0, NULL, NULL)
+ || SQL_ERROR == SQL->StmtBindColumn(stmt, 15, SQLDT_INT, &p.max_hp, 0, NULL, NULL)
+ || SQL_ERROR == SQL->StmtBindColumn(stmt, 16, SQLDT_INT, &p.hp, 0, NULL, NULL)
+ || SQL_ERROR == SQL->StmtBindColumn(stmt, 17, SQLDT_INT, &p.max_sp, 0, NULL, NULL)
+ || SQL_ERROR == SQL->StmtBindColumn(stmt, 18, SQLDT_INT, &p.sp, 0, NULL, NULL)
+ || SQL_ERROR == SQL->StmtBindColumn(stmt, 19, SQLDT_UINT, &p.status_point, 0, NULL, NULL)
+ || SQL_ERROR == SQL->StmtBindColumn(stmt, 20, SQLDT_UINT, &p.skill_point, 0, NULL, NULL)
+ || SQL_ERROR == SQL->StmtBindColumn(stmt, 21, SQLDT_UINT, &p.option, 0, NULL, NULL)
+ || SQL_ERROR == SQL->StmtBindColumn(stmt, 22, SQLDT_UCHAR, &p.karma, 0, NULL, NULL)
+ || SQL_ERROR == SQL->StmtBindColumn(stmt, 23, SQLDT_SHORT, &p.manner, 0, NULL, NULL)
+ || SQL_ERROR == SQL->StmtBindColumn(stmt, 24, SQLDT_SHORT, &p.hair, 0, NULL, NULL)
+ || SQL_ERROR == SQL->StmtBindColumn(stmt, 25, SQLDT_SHORT, &p.hair_color, 0, NULL, NULL)
+ || SQL_ERROR == SQL->StmtBindColumn(stmt, 26, SQLDT_SHORT, &p.clothes_color, 0, NULL, NULL)
+ || SQL_ERROR == SQL->StmtBindColumn(stmt, 27, SQLDT_SHORT, &p.weapon, 0, NULL, NULL)
+ || SQL_ERROR == SQL->StmtBindColumn(stmt, 28, SQLDT_SHORT, &p.shield, 0, NULL, NULL)
+ || SQL_ERROR == SQL->StmtBindColumn(stmt, 29, SQLDT_SHORT, &p.head_top, 0, NULL, NULL)
+ || SQL_ERROR == SQL->StmtBindColumn(stmt, 30, SQLDT_SHORT, &p.head_mid, 0, NULL, NULL)
+ || SQL_ERROR == SQL->StmtBindColumn(stmt, 31, SQLDT_SHORT, &p.head_bottom, 0, NULL, NULL)
+ || SQL_ERROR == SQL->StmtBindColumn(stmt, 32, SQLDT_STRING, &last_map, sizeof(last_map), NULL, NULL)
+ || SQL_ERROR == SQL->StmtBindColumn(stmt, 33, SQLDT_USHORT, &p.rename, 0, NULL, NULL)
+ || SQL_ERROR == SQL->StmtBindColumn(stmt, 34, SQLDT_UINT32, &p.delete_date, 0, NULL, NULL)
+ || SQL_ERROR == SQL->StmtBindColumn(stmt, 35, SQLDT_SHORT, &p.robe, 0, NULL, NULL)
+ || SQL_ERROR == SQL->StmtBindColumn(stmt, 36, SQLDT_USHORT, &p.slotchange, 0, NULL, NULL)
)
{
SqlStmt_ShowDebug(stmt);
- SqlStmt_Free(stmt);
+ SQL->StmtFree(stmt);
return 0;
}
- for( i = 0; i < MAX_CHARS && SQL_SUCCESS == SqlStmt_NextRow(stmt); i++ ) {
+ for( i = 0; i < MAX_CHARS && SQL_SUCCESS == SQL->StmtNextRow(stmt); i++ ) {
p.last_point.map = mapindex_name2id(last_map);
sd->found_char[p.slot] = p.char_id;
j += mmo_char_tobuf(WBUFP(buf, j), &p);
@@ -1055,7 +1056,7 @@ int mmo_chars_fromsql(struct char_session_data* sd, uint8* buf)
memset(sd->new_name,0,sizeof(sd->new_name));
- SqlStmt_Free(stmt);
+ SQL->StmtFree(stmt);
return j;
}
@@ -1084,7 +1085,7 @@ int mmo_char_fromsql(int char_id, struct mmo_charstatus* p, bool load_everything
if (save_log) ShowInfo("Char load request (%d)\n", char_id);
- stmt = SqlStmt_Malloc(sql_handle);
+ stmt = SQL->StmtMalloc(sql_handle);
if( stmt == NULL )
{
SqlStmt_ShowDebug(stmt);
@@ -1092,7 +1093,7 @@ int mmo_char_fromsql(int char_id, struct mmo_charstatus* p, bool load_everything
}
// read char data
- if( SQL_ERROR == SqlStmt_Prepare(stmt, "SELECT "
+ if( SQL_ERROR == SQL->StmtPrepare(stmt, "SELECT "
"`char_id`,`account_id`,`char_num`,`name`,`class`,`base_level`,`job_level`,`base_exp`,`job_exp`,`zeny`,"
"`str`,`agi`,`vit`,`int`,`dex`,`luk`,`max_hp`,`hp`,`max_sp`,`sp`,"
"`status_point`,`skill_point`,`option`,`karma`,`manner`,`party_id`,`guild_id`,`pet_id`,`homun_id`,`elemental_id`,`hair`,"
@@ -1100,72 +1101,72 @@ int mmo_char_fromsql(int char_id, struct mmo_charstatus* p, bool load_everything
"`save_map`,`save_x`,`save_y`,`partner_id`,`father`,`mother`,`child`,`fame`,`rename`,`delete_date`,`robe`,`slotchange`,"
"`char_opt`"
" FROM `%s` WHERE `char_id`=? LIMIT 1", char_db)
- || SQL_ERROR == SqlStmt_BindParam(stmt, 0, SQLDT_INT, &char_id, 0)
- || SQL_ERROR == SqlStmt_Execute(stmt)
- || SQL_ERROR == SqlStmt_BindColumn(stmt, 0, SQLDT_INT, &p->char_id, 0, NULL, NULL)
- || SQL_ERROR == SqlStmt_BindColumn(stmt, 1, SQLDT_INT, &p->account_id, 0, NULL, NULL)
- || SQL_ERROR == SqlStmt_BindColumn(stmt, 2, SQLDT_UCHAR, &p->slot, 0, NULL, NULL)
- || SQL_ERROR == SqlStmt_BindColumn(stmt, 3, SQLDT_STRING, &p->name, sizeof(p->name), NULL, NULL)
- || SQL_ERROR == SqlStmt_BindColumn(stmt, 4, SQLDT_SHORT, &p->class_, 0, NULL, NULL)
- || SQL_ERROR == SqlStmt_BindColumn(stmt, 5, SQLDT_UINT, &p->base_level, 0, NULL, NULL)
- || SQL_ERROR == SqlStmt_BindColumn(stmt, 6, SQLDT_UINT, &p->job_level, 0, NULL, NULL)
- || SQL_ERROR == SqlStmt_BindColumn(stmt, 7, SQLDT_UINT, &p->base_exp, 0, NULL, NULL)
- || SQL_ERROR == SqlStmt_BindColumn(stmt, 8, SQLDT_UINT, &p->job_exp, 0, NULL, NULL)
- || SQL_ERROR == SqlStmt_BindColumn(stmt, 9, SQLDT_INT, &p->zeny, 0, NULL, NULL)
- || SQL_ERROR == SqlStmt_BindColumn(stmt, 10, SQLDT_SHORT, &p->str, 0, NULL, NULL)
- || SQL_ERROR == SqlStmt_BindColumn(stmt, 11, SQLDT_SHORT, &p->agi, 0, NULL, NULL)
- || SQL_ERROR == SqlStmt_BindColumn(stmt, 12, SQLDT_SHORT, &p->vit, 0, NULL, NULL)
- || SQL_ERROR == SqlStmt_BindColumn(stmt, 13, SQLDT_SHORT, &p->int_, 0, NULL, NULL)
- || SQL_ERROR == SqlStmt_BindColumn(stmt, 14, SQLDT_SHORT, &p->dex, 0, NULL, NULL)
- || SQL_ERROR == SqlStmt_BindColumn(stmt, 15, SQLDT_SHORT, &p->luk, 0, NULL, NULL)
- || SQL_ERROR == SqlStmt_BindColumn(stmt, 16, SQLDT_INT, &p->max_hp, 0, NULL, NULL)
- || SQL_ERROR == SqlStmt_BindColumn(stmt, 17, SQLDT_INT, &p->hp, 0, NULL, NULL)
- || SQL_ERROR == SqlStmt_BindColumn(stmt, 18, SQLDT_INT, &p->max_sp, 0, NULL, NULL)
- || SQL_ERROR == SqlStmt_BindColumn(stmt, 19, SQLDT_INT, &p->sp, 0, NULL, NULL)
- || SQL_ERROR == SqlStmt_BindColumn(stmt, 20, SQLDT_UINT, &p->status_point, 0, NULL, NULL)
- || SQL_ERROR == SqlStmt_BindColumn(stmt, 21, SQLDT_UINT, &p->skill_point, 0, NULL, NULL)
- || SQL_ERROR == SqlStmt_BindColumn(stmt, 22, SQLDT_UINT, &p->option, 0, NULL, NULL)
- || SQL_ERROR == SqlStmt_BindColumn(stmt, 23, SQLDT_UCHAR, &p->karma, 0, NULL, NULL)
- || SQL_ERROR == SqlStmt_BindColumn(stmt, 24, SQLDT_SHORT, &p->manner, 0, NULL, NULL)
- || SQL_ERROR == SqlStmt_BindColumn(stmt, 25, SQLDT_INT, &p->party_id, 0, NULL, NULL)
- || SQL_ERROR == SqlStmt_BindColumn(stmt, 26, SQLDT_INT, &p->guild_id, 0, NULL, NULL)
- || SQL_ERROR == SqlStmt_BindColumn(stmt, 27, SQLDT_INT, &p->pet_id, 0, NULL, NULL)
- || SQL_ERROR == SqlStmt_BindColumn(stmt, 28, SQLDT_INT, &p->hom_id, 0, NULL, NULL)
- || SQL_ERROR == SqlStmt_BindColumn(stmt, 29, SQLDT_INT, &p->ele_id, 0, NULL, NULL)
- || SQL_ERROR == SqlStmt_BindColumn(stmt, 30, SQLDT_SHORT, &p->hair, 0, NULL, NULL)
- || SQL_ERROR == SqlStmt_BindColumn(stmt, 31, SQLDT_SHORT, &p->hair_color, 0, NULL, NULL)
- || SQL_ERROR == SqlStmt_BindColumn(stmt, 32, SQLDT_SHORT, &p->clothes_color, 0, NULL, NULL)
- || SQL_ERROR == SqlStmt_BindColumn(stmt, 33, SQLDT_SHORT, &p->weapon, 0, NULL, NULL)
- || SQL_ERROR == SqlStmt_BindColumn(stmt, 34, SQLDT_SHORT, &p->shield, 0, NULL, NULL)
- || SQL_ERROR == SqlStmt_BindColumn(stmt, 35, SQLDT_SHORT, &p->head_top, 0, NULL, NULL)
- || SQL_ERROR == SqlStmt_BindColumn(stmt, 36, SQLDT_SHORT, &p->head_mid, 0, NULL, NULL)
- || SQL_ERROR == SqlStmt_BindColumn(stmt, 37, SQLDT_SHORT, &p->head_bottom, 0, NULL, NULL)
- || SQL_ERROR == SqlStmt_BindColumn(stmt, 38, SQLDT_STRING, &last_map, sizeof(last_map), NULL, NULL)
- || SQL_ERROR == SqlStmt_BindColumn(stmt, 39, SQLDT_SHORT, &p->last_point.x, 0, NULL, NULL)
- || SQL_ERROR == SqlStmt_BindColumn(stmt, 40, SQLDT_SHORT, &p->last_point.y, 0, NULL, NULL)
- || SQL_ERROR == SqlStmt_BindColumn(stmt, 41, SQLDT_STRING, &save_map, sizeof(save_map), NULL, NULL)
- || SQL_ERROR == SqlStmt_BindColumn(stmt, 42, SQLDT_SHORT, &p->save_point.x, 0, NULL, NULL)
- || SQL_ERROR == SqlStmt_BindColumn(stmt, 43, SQLDT_SHORT, &p->save_point.y, 0, NULL, NULL)
- || SQL_ERROR == SqlStmt_BindColumn(stmt, 44, SQLDT_INT, &p->partner_id, 0, NULL, NULL)
- || SQL_ERROR == SqlStmt_BindColumn(stmt, 45, SQLDT_INT, &p->father, 0, NULL, NULL)
- || SQL_ERROR == SqlStmt_BindColumn(stmt, 46, SQLDT_INT, &p->mother, 0, NULL, NULL)
- || SQL_ERROR == SqlStmt_BindColumn(stmt, 47, SQLDT_INT, &p->child, 0, NULL, NULL)
- || SQL_ERROR == SqlStmt_BindColumn(stmt, 48, SQLDT_INT, &p->fame, 0, NULL, NULL)
- || SQL_ERROR == SqlStmt_BindColumn(stmt, 49, SQLDT_USHORT, &p->rename, 0, NULL, NULL)
- || SQL_ERROR == SqlStmt_BindColumn(stmt, 50, SQLDT_UINT32, &p->delete_date, 0, NULL, NULL)
- || SQL_ERROR == SqlStmt_BindColumn(stmt, 51, SQLDT_SHORT, &p->robe, 0, NULL, NULL)
- || SQL_ERROR == SqlStmt_BindColumn(stmt, 52, SQLDT_USHORT, &p->slotchange, 0, NULL, NULL)
- || SQL_ERROR == SqlStmt_BindColumn(stmt, 53, SQLDT_UINT, &opt, 0, NULL, NULL)
+ || SQL_ERROR == SQL->StmtBindParam(stmt, 0, SQLDT_INT, &char_id, 0)
+ || SQL_ERROR == SQL->StmtExecute(stmt)
+ || SQL_ERROR == SQL->StmtBindColumn(stmt, 0, SQLDT_INT, &p->char_id, 0, NULL, NULL)
+ || SQL_ERROR == SQL->StmtBindColumn(stmt, 1, SQLDT_INT, &p->account_id, 0, NULL, NULL)
+ || SQL_ERROR == SQL->StmtBindColumn(stmt, 2, SQLDT_UCHAR, &p->slot, 0, NULL, NULL)
+ || SQL_ERROR == SQL->StmtBindColumn(stmt, 3, SQLDT_STRING, &p->name, sizeof(p->name), NULL, NULL)
+ || SQL_ERROR == SQL->StmtBindColumn(stmt, 4, SQLDT_SHORT, &p->class_, 0, NULL, NULL)
+ || SQL_ERROR == SQL->StmtBindColumn(stmt, 5, SQLDT_UINT, &p->base_level, 0, NULL, NULL)
+ || SQL_ERROR == SQL->StmtBindColumn(stmt, 6, SQLDT_UINT, &p->job_level, 0, NULL, NULL)
+ || SQL_ERROR == SQL->StmtBindColumn(stmt, 7, SQLDT_UINT, &p->base_exp, 0, NULL, NULL)
+ || SQL_ERROR == SQL->StmtBindColumn(stmt, 8, SQLDT_UINT, &p->job_exp, 0, NULL, NULL)
+ || SQL_ERROR == SQL->StmtBindColumn(stmt, 9, SQLDT_INT, &p->zeny, 0, NULL, NULL)
+ || SQL_ERROR == SQL->StmtBindColumn(stmt, 10, SQLDT_SHORT, &p->str, 0, NULL, NULL)
+ || SQL_ERROR == SQL->StmtBindColumn(stmt, 11, SQLDT_SHORT, &p->agi, 0, NULL, NULL)
+ || SQL_ERROR == SQL->StmtBindColumn(stmt, 12, SQLDT_SHORT, &p->vit, 0, NULL, NULL)
+ || SQL_ERROR == SQL->StmtBindColumn(stmt, 13, SQLDT_SHORT, &p->int_, 0, NULL, NULL)
+ || SQL_ERROR == SQL->StmtBindColumn(stmt, 14, SQLDT_SHORT, &p->dex, 0, NULL, NULL)
+ || SQL_ERROR == SQL->StmtBindColumn(stmt, 15, SQLDT_SHORT, &p->luk, 0, NULL, NULL)
+ || SQL_ERROR == SQL->StmtBindColumn(stmt, 16, SQLDT_INT, &p->max_hp, 0, NULL, NULL)
+ || SQL_ERROR == SQL->StmtBindColumn(stmt, 17, SQLDT_INT, &p->hp, 0, NULL, NULL)
+ || SQL_ERROR == SQL->StmtBindColumn(stmt, 18, SQLDT_INT, &p->max_sp, 0, NULL, NULL)
+ || SQL_ERROR == SQL->StmtBindColumn(stmt, 19, SQLDT_INT, &p->sp, 0, NULL, NULL)
+ || SQL_ERROR == SQL->StmtBindColumn(stmt, 20, SQLDT_UINT, &p->status_point, 0, NULL, NULL)
+ || SQL_ERROR == SQL->StmtBindColumn(stmt, 21, SQLDT_UINT, &p->skill_point, 0, NULL, NULL)
+ || SQL_ERROR == SQL->StmtBindColumn(stmt, 22, SQLDT_UINT, &p->option, 0, NULL, NULL)
+ || SQL_ERROR == SQL->StmtBindColumn(stmt, 23, SQLDT_UCHAR, &p->karma, 0, NULL, NULL)
+ || SQL_ERROR == SQL->StmtBindColumn(stmt, 24, SQLDT_SHORT, &p->manner, 0, NULL, NULL)
+ || SQL_ERROR == SQL->StmtBindColumn(stmt, 25, SQLDT_INT, &p->party_id, 0, NULL, NULL)
+ || SQL_ERROR == SQL->StmtBindColumn(stmt, 26, SQLDT_INT, &p->guild_id, 0, NULL, NULL)
+ || SQL_ERROR == SQL->StmtBindColumn(stmt, 27, SQLDT_INT, &p->pet_id, 0, NULL, NULL)
+ || SQL_ERROR == SQL->StmtBindColumn(stmt, 28, SQLDT_INT, &p->hom_id, 0, NULL, NULL)
+ || SQL_ERROR == SQL->StmtBindColumn(stmt, 29, SQLDT_INT, &p->ele_id, 0, NULL, NULL)
+ || SQL_ERROR == SQL->StmtBindColumn(stmt, 30, SQLDT_SHORT, &p->hair, 0, NULL, NULL)
+ || SQL_ERROR == SQL->StmtBindColumn(stmt, 31, SQLDT_SHORT, &p->hair_color, 0, NULL, NULL)
+ || SQL_ERROR == SQL->StmtBindColumn(stmt, 32, SQLDT_SHORT, &p->clothes_color, 0, NULL, NULL)
+ || SQL_ERROR == SQL->StmtBindColumn(stmt, 33, SQLDT_SHORT, &p->weapon, 0, NULL, NULL)
+ || SQL_ERROR == SQL->StmtBindColumn(stmt, 34, SQLDT_SHORT, &p->shield, 0, NULL, NULL)
+ || SQL_ERROR == SQL->StmtBindColumn(stmt, 35, SQLDT_SHORT, &p->head_top, 0, NULL, NULL)
+ || SQL_ERROR == SQL->StmtBindColumn(stmt, 36, SQLDT_SHORT, &p->head_mid, 0, NULL, NULL)
+ || SQL_ERROR == SQL->StmtBindColumn(stmt, 37, SQLDT_SHORT, &p->head_bottom, 0, NULL, NULL)
+ || SQL_ERROR == SQL->StmtBindColumn(stmt, 38, SQLDT_STRING, &last_map, sizeof(last_map), NULL, NULL)
+ || SQL_ERROR == SQL->StmtBindColumn(stmt, 39, SQLDT_SHORT, &p->last_point.x, 0, NULL, NULL)
+ || SQL_ERROR == SQL->StmtBindColumn(stmt, 40, SQLDT_SHORT, &p->last_point.y, 0, NULL, NULL)
+ || SQL_ERROR == SQL->StmtBindColumn(stmt, 41, SQLDT_STRING, &save_map, sizeof(save_map), NULL, NULL)
+ || SQL_ERROR == SQL->StmtBindColumn(stmt, 42, SQLDT_SHORT, &p->save_point.x, 0, NULL, NULL)
+ || SQL_ERROR == SQL->StmtBindColumn(stmt, 43, SQLDT_SHORT, &p->save_point.y, 0, NULL, NULL)
+ || SQL_ERROR == SQL->StmtBindColumn(stmt, 44, SQLDT_INT, &p->partner_id, 0, NULL, NULL)
+ || SQL_ERROR == SQL->StmtBindColumn(stmt, 45, SQLDT_INT, &p->father, 0, NULL, NULL)
+ || SQL_ERROR == SQL->StmtBindColumn(stmt, 46, SQLDT_INT, &p->mother, 0, NULL, NULL)
+ || SQL_ERROR == SQL->StmtBindColumn(stmt, 47, SQLDT_INT, &p->child, 0, NULL, NULL)
+ || SQL_ERROR == SQL->StmtBindColumn(stmt, 48, SQLDT_INT, &p->fame, 0, NULL, NULL)
+ || SQL_ERROR == SQL->StmtBindColumn(stmt, 49, SQLDT_USHORT, &p->rename, 0, NULL, NULL)
+ || SQL_ERROR == SQL->StmtBindColumn(stmt, 50, SQLDT_UINT32, &p->delete_date, 0, NULL, NULL)
+ || SQL_ERROR == SQL->StmtBindColumn(stmt, 51, SQLDT_SHORT, &p->robe, 0, NULL, NULL)
+ || SQL_ERROR == SQL->StmtBindColumn(stmt, 52, SQLDT_USHORT, &p->slotchange, 0, NULL, NULL)
+ || SQL_ERROR == SQL->StmtBindColumn(stmt, 53, SQLDT_UINT, &opt, 0, NULL, NULL)
)
{
SqlStmt_ShowDebug(stmt);
- SqlStmt_Free(stmt);
+ SQL->StmtFree(stmt);
return 0;
}
- if( SQL_ERROR == SqlStmt_NextRow(stmt) )
+ if( SQL_ERROR == SQL->StmtNextRow(stmt) )
{
ShowError("Requested non-existant character id: %d!\n", char_id);
- SqlStmt_Free(stmt);
+ SQL->StmtFree(stmt);
return 0;
}
p->last_point.map = mapindex_name2id(last_map);
@@ -1187,21 +1188,21 @@ int mmo_char_fromsql(int char_id, struct mmo_charstatus* p, bool load_everything
if (!load_everything) // For quick selection of data when displaying the char menu
{
- SqlStmt_Free(stmt);
+ SQL->StmtFree(stmt);
return 1;
}
//read memo data
//`memo` (`memo_id`,`char_id`,`map`,`x`,`y`)
- if( SQL_ERROR == SqlStmt_Prepare(stmt, "SELECT `map`,`x`,`y` FROM `%s` WHERE `char_id`=? ORDER by `memo_id` LIMIT %d", memo_db, MAX_MEMOPOINTS)
- || SQL_ERROR == SqlStmt_BindParam(stmt, 0, SQLDT_INT, &char_id, 0)
- || SQL_ERROR == SqlStmt_Execute(stmt)
- || SQL_ERROR == SqlStmt_BindColumn(stmt, 0, SQLDT_STRING, &point_map, sizeof(point_map), NULL, NULL)
- || SQL_ERROR == SqlStmt_BindColumn(stmt, 1, SQLDT_SHORT, &tmp_point.x, 0, NULL, NULL)
- || SQL_ERROR == SqlStmt_BindColumn(stmt, 2, SQLDT_SHORT, &tmp_point.y, 0, NULL, NULL) )
+ if( SQL_ERROR == SQL->StmtPrepare(stmt, "SELECT `map`,`x`,`y` FROM `%s` WHERE `char_id`=? ORDER by `memo_id` LIMIT %d", memo_db, MAX_MEMOPOINTS)
+ || SQL_ERROR == SQL->StmtBindParam(stmt, 0, SQLDT_INT, &char_id, 0)
+ || SQL_ERROR == SQL->StmtExecute(stmt)
+ || SQL_ERROR == SQL->StmtBindColumn(stmt, 0, SQLDT_STRING, &point_map, sizeof(point_map), NULL, NULL)
+ || SQL_ERROR == SQL->StmtBindColumn(stmt, 1, SQLDT_SHORT, &tmp_point.x, 0, NULL, NULL)
+ || SQL_ERROR == SQL->StmtBindColumn(stmt, 2, SQLDT_SHORT, &tmp_point.y, 0, NULL, NULL) )
SqlStmt_ShowDebug(stmt);
- for( i = 0; i < MAX_MEMOPOINTS && SQL_SUCCESS == SqlStmt_NextRow(stmt); ++i ) {
+ for( i = 0; i < MAX_MEMOPOINTS && SQL_SUCCESS == SQL->StmtNextRow(stmt); ++i ) {
tmp_point.map = mapindex_name2id(point_map);
memcpy(&p->memo_point[i], &tmp_point, sizeof(tmp_point));
}
@@ -1215,25 +1216,25 @@ int mmo_char_fromsql(int char_id, struct mmo_charstatus* p, bool load_everything
StrBuf->Printf(&buf, ", `card%d`", i);
StrBuf->Printf(&buf, " FROM `%s` WHERE `char_id`=? LIMIT %d", inventory_db, MAX_INVENTORY);
- if( SQL_ERROR == SqlStmt_PrepareStr(stmt, StrBuf->Value(&buf))
- || SQL_ERROR == SqlStmt_BindParam(stmt, 0, SQLDT_INT, &char_id, 0)
- || SQL_ERROR == SqlStmt_Execute(stmt)
- || SQL_ERROR == SqlStmt_BindColumn(stmt, 0, SQLDT_INT, &tmp_item.id, 0, NULL, NULL)
- || SQL_ERROR == SqlStmt_BindColumn(stmt, 1, SQLDT_SHORT, &tmp_item.nameid, 0, NULL, NULL)
- || SQL_ERROR == SqlStmt_BindColumn(stmt, 2, SQLDT_SHORT, &tmp_item.amount, 0, NULL, NULL)
- || SQL_ERROR == SqlStmt_BindColumn(stmt, 3, SQLDT_USHORT, &tmp_item.equip, 0, NULL, NULL)
- || SQL_ERROR == SqlStmt_BindColumn(stmt, 4, SQLDT_CHAR, &tmp_item.identify, 0, NULL, NULL)
- || SQL_ERROR == SqlStmt_BindColumn(stmt, 5, SQLDT_CHAR, &tmp_item.refine, 0, NULL, NULL)
- || SQL_ERROR == SqlStmt_BindColumn(stmt, 6, SQLDT_CHAR, &tmp_item.attribute, 0, NULL, NULL)
- || SQL_ERROR == SqlStmt_BindColumn(stmt, 7, SQLDT_UINT, &tmp_item.expire_time, 0, NULL, NULL)
- || SQL_ERROR == SqlStmt_BindColumn(stmt, 8, SQLDT_CHAR, &tmp_item.favorite, 0, NULL, NULL)
- || SQL_ERROR == SqlStmt_BindColumn(stmt, 9, SQLDT_ULONGLONG, &tmp_item.unique_id, 0, NULL, NULL) )
+ if( SQL_ERROR == SQL->StmtPrepareStr(stmt, StrBuf->Value(&buf))
+ || SQL_ERROR == SQL->StmtBindParam(stmt, 0, SQLDT_INT, &char_id, 0)
+ || SQL_ERROR == SQL->StmtExecute(stmt)
+ || SQL_ERROR == SQL->StmtBindColumn(stmt, 0, SQLDT_INT, &tmp_item.id, 0, NULL, NULL)
+ || SQL_ERROR == SQL->StmtBindColumn(stmt, 1, SQLDT_SHORT, &tmp_item.nameid, 0, NULL, NULL)
+ || SQL_ERROR == SQL->StmtBindColumn(stmt, 2, SQLDT_SHORT, &tmp_item.amount, 0, NULL, NULL)
+ || SQL_ERROR == SQL->StmtBindColumn(stmt, 3, SQLDT_USHORT, &tmp_item.equip, 0, NULL, NULL)
+ || SQL_ERROR == SQL->StmtBindColumn(stmt, 4, SQLDT_CHAR, &tmp_item.identify, 0, NULL, NULL)
+ || SQL_ERROR == SQL->StmtBindColumn(stmt, 5, SQLDT_CHAR, &tmp_item.refine, 0, NULL, NULL)
+ || SQL_ERROR == SQL->StmtBindColumn(stmt, 6, SQLDT_CHAR, &tmp_item.attribute, 0, NULL, NULL)
+ || SQL_ERROR == SQL->StmtBindColumn(stmt, 7, SQLDT_UINT, &tmp_item.expire_time, 0, NULL, NULL)
+ || SQL_ERROR == SQL->StmtBindColumn(stmt, 8, SQLDT_CHAR, &tmp_item.favorite, 0, NULL, NULL)
+ || SQL_ERROR == SQL->StmtBindColumn(stmt, 9, SQLDT_ULONGLONG, &tmp_item.unique_id, 0, NULL, NULL) )
SqlStmt_ShowDebug(stmt);
for( i = 0; i < MAX_SLOTS; ++i )
- if( SQL_ERROR == SqlStmt_BindColumn(stmt, 10+i, SQLDT_SHORT, &tmp_item.card[i], 0, NULL, NULL) )
+ if( SQL_ERROR == SQL->StmtBindColumn(stmt, 10+i, SQLDT_SHORT, &tmp_item.card[i], 0, NULL, NULL) )
SqlStmt_ShowDebug(stmt);
- for( i = 0; i < MAX_INVENTORY && SQL_SUCCESS == SqlStmt_NextRow(stmt); ++i )
+ for( i = 0; i < MAX_INVENTORY && SQL_SUCCESS == SQL->StmtNextRow(stmt); ++i )
memcpy(&p->inventory[i], &tmp_item, sizeof(tmp_item));
strcat(t_msg, " inventory");
@@ -1246,24 +1247,24 @@ int mmo_char_fromsql(int char_id, struct mmo_charstatus* p, bool load_everything
StrBuf->Printf(&buf, ", `card%d`", j);
StrBuf->Printf(&buf, " FROM `%s` WHERE `char_id`=? LIMIT %d", cart_db, MAX_CART);
- if( SQL_ERROR == SqlStmt_PrepareStr(stmt, StrBuf->Value(&buf))
- || SQL_ERROR == SqlStmt_BindParam(stmt, 0, SQLDT_INT, &char_id, 0)
- || SQL_ERROR == SqlStmt_Execute(stmt)
- || SQL_ERROR == SqlStmt_BindColumn(stmt, 0, SQLDT_INT, &tmp_item.id, 0, NULL, NULL)
- || SQL_ERROR == SqlStmt_BindColumn(stmt, 1, SQLDT_SHORT, &tmp_item.nameid, 0, NULL, NULL)
- || SQL_ERROR == SqlStmt_BindColumn(stmt, 2, SQLDT_SHORT, &tmp_item.amount, 0, NULL, NULL)
- || SQL_ERROR == SqlStmt_BindColumn(stmt, 3, SQLDT_USHORT, &tmp_item.equip, 0, NULL, NULL)
- || SQL_ERROR == SqlStmt_BindColumn(stmt, 4, SQLDT_CHAR, &tmp_item.identify, 0, NULL, NULL)
- || SQL_ERROR == SqlStmt_BindColumn(stmt, 5, SQLDT_CHAR, &tmp_item.refine, 0, NULL, NULL)
- || SQL_ERROR == SqlStmt_BindColumn(stmt, 6, SQLDT_CHAR, &tmp_item.attribute, 0, NULL, NULL)
- || SQL_ERROR == SqlStmt_BindColumn(stmt, 7, SQLDT_UINT, &tmp_item.expire_time, 0, NULL, NULL)
- || SQL_ERROR == SqlStmt_BindColumn(stmt, 8, SQLDT_ULONGLONG, &tmp_item.unique_id, 0, NULL, NULL) )
+ if( SQL_ERROR == SQL->StmtPrepareStr(stmt, StrBuf->Value(&buf))
+ || SQL_ERROR == SQL->StmtBindParam(stmt, 0, SQLDT_INT, &char_id, 0)
+ || SQL_ERROR == SQL->StmtExecute(stmt)
+ || SQL_ERROR == SQL->StmtBindColumn(stmt, 0, SQLDT_INT, &tmp_item.id, 0, NULL, NULL)
+ || SQL_ERROR == SQL->StmtBindColumn(stmt, 1, SQLDT_SHORT, &tmp_item.nameid, 0, NULL, NULL)
+ || SQL_ERROR == SQL->StmtBindColumn(stmt, 2, SQLDT_SHORT, &tmp_item.amount, 0, NULL, NULL)
+ || SQL_ERROR == SQL->StmtBindColumn(stmt, 3, SQLDT_USHORT, &tmp_item.equip, 0, NULL, NULL)
+ || SQL_ERROR == SQL->StmtBindColumn(stmt, 4, SQLDT_CHAR, &tmp_item.identify, 0, NULL, NULL)
+ || SQL_ERROR == SQL->StmtBindColumn(stmt, 5, SQLDT_CHAR, &tmp_item.refine, 0, NULL, NULL)
+ || SQL_ERROR == SQL->StmtBindColumn(stmt, 6, SQLDT_CHAR, &tmp_item.attribute, 0, NULL, NULL)
+ || SQL_ERROR == SQL->StmtBindColumn(stmt, 7, SQLDT_UINT, &tmp_item.expire_time, 0, NULL, NULL)
+ || SQL_ERROR == SQL->StmtBindColumn(stmt, 8, SQLDT_ULONGLONG, &tmp_item.unique_id, 0, NULL, NULL) )
SqlStmt_ShowDebug(stmt);
for( i = 0; i < MAX_SLOTS; ++i )
- if( SQL_ERROR == SqlStmt_BindColumn(stmt, 9+i, SQLDT_SHORT, &tmp_item.card[i], 0, NULL, NULL) )
+ if( SQL_ERROR == SQL->StmtBindColumn(stmt, 9+i, SQLDT_SHORT, &tmp_item.card[i], 0, NULL, NULL) )
SqlStmt_ShowDebug(stmt);
- for( i = 0; i < MAX_CART && SQL_SUCCESS == SqlStmt_NextRow(stmt); ++i )
+ for( i = 0; i < MAX_CART && SQL_SUCCESS == SQL->StmtNextRow(stmt); ++i )
memcpy(&p->cart[i], &tmp_item, sizeof(tmp_item));
strcat(t_msg, " cart");
@@ -1273,18 +1274,18 @@ int mmo_char_fromsql(int char_id, struct mmo_charstatus* p, bool load_everything
//read skill
//`skill` (`char_id`, `id`, `lv`)
- if( SQL_ERROR == SqlStmt_Prepare(stmt, "SELECT `id`, `lv`,`flag` FROM `%s` WHERE `char_id`=? LIMIT %d", skill_db, MAX_SKILL)
- || SQL_ERROR == SqlStmt_BindParam(stmt, 0, SQLDT_INT, &char_id, 0)
- || SQL_ERROR == SqlStmt_Execute(stmt)
- || SQL_ERROR == SqlStmt_BindColumn(stmt, 0, SQLDT_USHORT, &tmp_skill.id , 0, NULL, NULL)
- || SQL_ERROR == SqlStmt_BindColumn(stmt, 1, SQLDT_UCHAR , &tmp_skill.lv , 0, NULL, NULL)
- || SQL_ERROR == SqlStmt_BindColumn(stmt, 2, SQLDT_UCHAR , &tmp_skill.flag, 0, NULL, NULL) )
+ if( SQL_ERROR == SQL->StmtPrepare(stmt, "SELECT `id`, `lv`,`flag` FROM `%s` WHERE `char_id`=? LIMIT %d", skill_db, MAX_SKILL)
+ || SQL_ERROR == SQL->StmtBindParam(stmt, 0, SQLDT_INT, &char_id, 0)
+ || SQL_ERROR == SQL->StmtExecute(stmt)
+ || SQL_ERROR == SQL->StmtBindColumn(stmt, 0, SQLDT_USHORT, &tmp_skill.id , 0, NULL, NULL)
+ || SQL_ERROR == SQL->StmtBindColumn(stmt, 1, SQLDT_UCHAR , &tmp_skill.lv , 0, NULL, NULL)
+ || SQL_ERROR == SQL->StmtBindColumn(stmt, 2, SQLDT_UCHAR , &tmp_skill.flag, 0, NULL, NULL) )
SqlStmt_ShowDebug(stmt);
if( tmp_skill.flag != SKILL_FLAG_PERM_GRANTED )
tmp_skill.flag = SKILL_FLAG_PERMANENT;
- for( i = 0; i < MAX_SKILL && SQL_SUCCESS == SqlStmt_NextRow(stmt); ++i ) {
+ for( i = 0; i < MAX_SKILL && SQL_SUCCESS == SQL->StmtNextRow(stmt); ++i ) {
if( skillid2idx[tmp_skill.id] )
memcpy(&p->skill[skillid2idx[tmp_skill.id]], &tmp_skill, sizeof(tmp_skill));
else
@@ -1294,31 +1295,31 @@ int mmo_char_fromsql(int char_id, struct mmo_charstatus* p, bool load_everything
//read friends
//`friends` (`char_id`, `friend_account`, `friend_id`)
- if( SQL_ERROR == SqlStmt_Prepare(stmt, "SELECT c.`account_id`, c.`char_id`, c.`name` FROM `%s` c LEFT JOIN `%s` f ON f.`friend_account` = c.`account_id` AND f.`friend_id` = c.`char_id` WHERE f.`char_id`=? LIMIT %d", char_db, friend_db, MAX_FRIENDS)
- || SQL_ERROR == SqlStmt_BindParam(stmt, 0, SQLDT_INT, &char_id, 0)
- || SQL_ERROR == SqlStmt_Execute(stmt)
- || SQL_ERROR == SqlStmt_BindColumn(stmt, 0, SQLDT_INT, &tmp_friend.account_id, 0, NULL, NULL)
- || SQL_ERROR == SqlStmt_BindColumn(stmt, 1, SQLDT_INT, &tmp_friend.char_id, 0, NULL, NULL)
- || SQL_ERROR == SqlStmt_BindColumn(stmt, 2, SQLDT_STRING, &tmp_friend.name, sizeof(tmp_friend.name), NULL, NULL) )
+ if( SQL_ERROR == SQL->StmtPrepare(stmt, "SELECT c.`account_id`, c.`char_id`, c.`name` FROM `%s` c LEFT JOIN `%s` f ON f.`friend_account` = c.`account_id` AND f.`friend_id` = c.`char_id` WHERE f.`char_id`=? LIMIT %d", char_db, friend_db, MAX_FRIENDS)
+ || SQL_ERROR == SQL->StmtBindParam(stmt, 0, SQLDT_INT, &char_id, 0)
+ || SQL_ERROR == SQL->StmtExecute(stmt)
+ || SQL_ERROR == SQL->StmtBindColumn(stmt, 0, SQLDT_INT, &tmp_friend.account_id, 0, NULL, NULL)
+ || SQL_ERROR == SQL->StmtBindColumn(stmt, 1, SQLDT_INT, &tmp_friend.char_id, 0, NULL, NULL)
+ || SQL_ERROR == SQL->StmtBindColumn(stmt, 2, SQLDT_STRING, &tmp_friend.name, sizeof(tmp_friend.name), NULL, NULL) )
SqlStmt_ShowDebug(stmt);
- for( i = 0; i < MAX_FRIENDS && SQL_SUCCESS == SqlStmt_NextRow(stmt); ++i )
+ for( i = 0; i < MAX_FRIENDS && SQL_SUCCESS == SQL->StmtNextRow(stmt); ++i )
memcpy(&p->friends[i], &tmp_friend, sizeof(tmp_friend));
strcat(t_msg, " friends");
#ifdef HOTKEY_SAVING
//read hotkeys
//`hotkey` (`char_id`, `hotkey`, `type`, `itemskill_id`, `skill_lvl`
- if( SQL_ERROR == SqlStmt_Prepare(stmt, "SELECT `hotkey`, `type`, `itemskill_id`, `skill_lvl` FROM `%s` WHERE `char_id`=?", hotkey_db)
- || SQL_ERROR == SqlStmt_BindParam(stmt, 0, SQLDT_INT, &char_id, 0)
- || SQL_ERROR == SqlStmt_Execute(stmt)
- || SQL_ERROR == SqlStmt_BindColumn(stmt, 0, SQLDT_INT, &hotkey_num, 0, NULL, NULL)
- || SQL_ERROR == SqlStmt_BindColumn(stmt, 1, SQLDT_UCHAR, &tmp_hotkey.type, 0, NULL, NULL)
- || SQL_ERROR == SqlStmt_BindColumn(stmt, 2, SQLDT_UINT, &tmp_hotkey.id, 0, NULL, NULL)
- || SQL_ERROR == SqlStmt_BindColumn(stmt, 3, SQLDT_USHORT, &tmp_hotkey.lv, 0, NULL, NULL) )
+ if( SQL_ERROR == SQL->StmtPrepare(stmt, "SELECT `hotkey`, `type`, `itemskill_id`, `skill_lvl` FROM `%s` WHERE `char_id`=?", hotkey_db)
+ || SQL_ERROR == SQL->StmtBindParam(stmt, 0, SQLDT_INT, &char_id, 0)
+ || SQL_ERROR == SQL->StmtExecute(stmt)
+ || SQL_ERROR == SQL->StmtBindColumn(stmt, 0, SQLDT_INT, &hotkey_num, 0, NULL, NULL)
+ || SQL_ERROR == SQL->StmtBindColumn(stmt, 1, SQLDT_UCHAR, &tmp_hotkey.type, 0, NULL, NULL)
+ || SQL_ERROR == SQL->StmtBindColumn(stmt, 2, SQLDT_UINT, &tmp_hotkey.id, 0, NULL, NULL)
+ || SQL_ERROR == SQL->StmtBindColumn(stmt, 3, SQLDT_USHORT, &tmp_hotkey.lv, 0, NULL, NULL) )
SqlStmt_ShowDebug(stmt);
- while( SQL_SUCCESS == SqlStmt_NextRow(stmt) )
+ while( SQL_SUCCESS == SQL->StmtNextRow(stmt) )
{
if( hotkey_num >= 0 && hotkey_num < MAX_HOTKEYS )
memcpy(&p->hotkeys[hotkey_num], &tmp_hotkey, sizeof(tmp_hotkey));
@@ -1334,7 +1335,7 @@ int mmo_char_fromsql(int char_id, struct mmo_charstatus* p, bool load_everything
if (save_log) ShowInfo("Loaded char (%d - %s): %s\n", char_id, p->name, t_msg); //ok. all data load successfuly!
- SqlStmt_Free(stmt);
+ SQL->StmtFree(stmt);
StrBuf->Destroy(&buf);
/* load options into proper vars */
@@ -4457,7 +4458,7 @@ int broadcast_user_count(int tid, unsigned int tick, int id, intptr_t data)
*/
static int send_accounts_tologin_sub(DBKey key, DBData *data, va_list ap)
{
- struct online_char_data* character = iDB->data2ptr(data);
+ struct online_char_data* character = DB->data2ptr(data);
int* i = va_arg(ap, int*);
if(character->server > -1)
@@ -4539,7 +4540,7 @@ static int chardb_waiting_disconnect(int tid, unsigned int tick, int id, intptr_
*/
static int online_data_cleanup_sub(DBKey key, DBData *data, va_list ap)
{
- struct online_char_data *character= iDB->data2ptr(data);
+ struct online_char_data *character= DB->data2ptr(data);
if (character->fd != -1)
return 0; //Character still connected
if (character->server == -2) //Unknown server.. set them offline
@@ -4686,6 +4687,10 @@ void sql_config_read(const char* cfgName)
safestrncpy(mercenary_db,w2,sizeof(mercenary_db));
else if(!strcmpi(w1,"mercenary_owner_db"))
safestrncpy(mercenary_owner_db,w2,sizeof(mercenary_owner_db));
+ else if(!strcmpi(w1,"ragsrvinfo_db"))
+ safestrncpy(ragsrvinfo_db,w2,sizeof(ragsrvinfo_db));
+ else if(!strcmpi(w1,"interreg_db"))
+ safestrncpy(interreg_db,w2,sizeof(interreg_db));
//support the import command, just like any other config
else if(!strcmpi(w1,"import"))
sql_config_read(w2);
diff --git a/src/char/char.h b/src/char/char.h
index 996a0e845..1a9441868 100644
--- a/src/char/char.h
+++ b/src/char/char.h
@@ -103,6 +103,7 @@ extern char skill_homunculus_db[256];
extern char mercenary_db[256];
extern char mercenary_owner_db[256];
extern char ragsrvinfo_db[256];
+extern char interreg_db[32];
extern int db_use_sqldbs; // added for sql item_db read for char server [Valaris]
diff --git a/src/char/int_auction.c b/src/char/int_auction.c
index c9195a380..bf5ea1700 100644
--- a/src/char/int_auction.c
+++ b/src/char/int_auction.c
@@ -56,17 +56,17 @@ void auction_save(struct auction_data *auction)
StrBuf->Printf(&buf, ", `card%d` = '%d'", j, auction->item.card[j]);
StrBuf->Printf(&buf, " WHERE `auction_id` = '%d'", auction->auction_id);
- stmt = SqlStmt_Malloc(sql_handle);
- if( SQL_SUCCESS != SqlStmt_PrepareStr(stmt, StrBuf->Value(&buf))
- || SQL_SUCCESS != SqlStmt_BindParam(stmt, 0, SQLDT_STRING, auction->seller_name, strnlen(auction->seller_name, NAME_LENGTH))
- || SQL_SUCCESS != SqlStmt_BindParam(stmt, 1, SQLDT_STRING, auction->buyer_name, strnlen(auction->buyer_name, NAME_LENGTH))
- || SQL_SUCCESS != SqlStmt_BindParam(stmt, 2, SQLDT_STRING, auction->item_name, strnlen(auction->item_name, ITEM_NAME_LENGTH))
- || SQL_SUCCESS != SqlStmt_Execute(stmt) )
+ stmt = SQL->StmtMalloc(sql_handle);
+ if( SQL_SUCCESS != SQL->StmtPrepareStr(stmt, StrBuf->Value(&buf))
+ || SQL_SUCCESS != SQL->StmtBindParam(stmt, 0, SQLDT_STRING, auction->seller_name, strnlen(auction->seller_name, NAME_LENGTH))
+ || SQL_SUCCESS != SQL->StmtBindParam(stmt, 1, SQLDT_STRING, auction->buyer_name, strnlen(auction->buyer_name, NAME_LENGTH))
+ || SQL_SUCCESS != SQL->StmtBindParam(stmt, 2, SQLDT_STRING, auction->item_name, strnlen(auction->item_name, ITEM_NAME_LENGTH))
+ || SQL_SUCCESS != SQL->StmtExecute(stmt) )
{
SqlStmt_ShowDebug(stmt);
}
- SqlStmt_Free(stmt);
+ SQL->StmtFree(stmt);
StrBuf->Destroy(&buf);
}
@@ -95,12 +95,12 @@ unsigned int auction_create(struct auction_data *auction)
updateLastUid(auction->item.unique_id);
dbUpdateUid(sql_handle);
- stmt = SqlStmt_Malloc(sql_handle);
- if( SQL_SUCCESS != SqlStmt_PrepareStr(stmt, StrBuf->Value(&buf))
- || SQL_SUCCESS != SqlStmt_BindParam(stmt, 0, SQLDT_STRING, auction->seller_name, strnlen(auction->seller_name, NAME_LENGTH))
- || SQL_SUCCESS != SqlStmt_BindParam(stmt, 1, SQLDT_STRING, auction->buyer_name, strnlen(auction->buyer_name, NAME_LENGTH))
- || SQL_SUCCESS != SqlStmt_BindParam(stmt, 2, SQLDT_STRING, auction->item_name, strnlen(auction->item_name, ITEM_NAME_LENGTH))
- || SQL_SUCCESS != SqlStmt_Execute(stmt) )
+ stmt = SQL->StmtMalloc(sql_handle);
+ if( SQL_SUCCESS != SQL->StmtPrepareStr(stmt, StrBuf->Value(&buf))
+ || SQL_SUCCESS != SQL->StmtBindParam(stmt, 0, SQLDT_STRING, auction->seller_name, strnlen(auction->seller_name, NAME_LENGTH))
+ || SQL_SUCCESS != SQL->StmtBindParam(stmt, 1, SQLDT_STRING, auction->buyer_name, strnlen(auction->buyer_name, NAME_LENGTH))
+ || SQL_SUCCESS != SQL->StmtBindParam(stmt, 2, SQLDT_STRING, auction->item_name, strnlen(auction->item_name, ITEM_NAME_LENGTH))
+ || SQL_SUCCESS != SQL->StmtExecute(stmt) )
{
SqlStmt_ShowDebug(stmt);
auction->auction_id = 0;
@@ -114,7 +114,7 @@ unsigned int auction_create(struct auction_data *auction)
auction->item.identify = 1;
auction->item.expire_time = 0;
- auction->auction_id = (unsigned int)SqlStmt_LastInsertId(stmt);
+ auction->auction_id = (unsigned int)SQL->StmtLastInsertId(stmt);
auction->auction_end_timer = iTimer->add_timer( iTimer->gettick() + tick , auction_end_timer, auction->auction_id, 0);
ShowInfo("New Auction %u | time left %u ms | By %s.\n", auction->auction_id, tick, auction->seller_name);
@@ -123,7 +123,7 @@ unsigned int auction_create(struct auction_data *auction)
idb_put(auction_db_, auction_->auction_id, auction_);
}
- SqlStmt_Free(stmt);
+ SQL->StmtFree(stmt);
StrBuf->Destroy(&buf);
return auction->auction_id;
diff --git a/src/char/int_guild.c b/src/char/int_guild.c
index 55f29953f..a9bce9cbe 100644
--- a/src/char/int_guild.c
+++ b/src/char/int_guild.c
@@ -57,7 +57,7 @@ static int guild_save_timer(int tid, unsigned int tick, int id, intptr_t data)
if( last_id == 0 ) //Save the first guild in the list.
state = 1;
- for( g = iDB->data2ptr(iter->first(iter, &key)); dbi_exists(iter); g = iDB->data2ptr(iter->next(iter, &key)) )
+ for( g = DB->data2ptr(iter->first(iter, &key)); dbi_exists(iter); g = DB->data2ptr(iter->next(iter, &key)) )
{
if( state == 0 && g->guild_id == last_id )
state++; //Save next guild in the list.
@@ -739,7 +739,7 @@ int inter_guild_sql_init(void)
*/
static int guild_db_final(DBKey key, DBData *data, va_list ap)
{
- struct guild *g = iDB->data2ptr(data);
+ struct guild *g = DB->data2ptr(data);
if (g->save_flag&GS_MASK) {
inter_guild_tosql(g, g->save_flag&GS_MASK);
return 1;
diff --git a/src/char/int_homun.c b/src/char/int_homun.c
index 6e4f63849..143277f05 100644
--- a/src/char/int_homun.c
+++ b/src/char/int_homun.c
@@ -121,25 +121,25 @@ bool mapif_homunculus_save(struct s_homunculus* hd)
SqlStmt* stmt;
int i;
- stmt = SqlStmt_Malloc(sql_handle);
- if( SQL_ERROR == SqlStmt_Prepare(stmt, "REPLACE INTO `%s` (`homun_id`, `id`, `lv`) VALUES (%d, ?, ?)", skill_homunculus_db, hd->hom_id) )
+ stmt = SQL->StmtMalloc(sql_handle);
+ if( SQL_ERROR == SQL->StmtPrepare(stmt, "REPLACE INTO `%s` (`homun_id`, `id`, `lv`) VALUES (%d, ?, ?)", skill_homunculus_db, hd->hom_id) )
SqlStmt_ShowDebug(stmt);
for( i = 0; i < MAX_HOMUNSKILL; ++i )
{
if( hd->hskill[i].id > 0 && hd->hskill[i].lv != 0 )
{
- SqlStmt_BindParam(stmt, 0, SQLDT_USHORT, &hd->hskill[i].id, 0);
- SqlStmt_BindParam(stmt, 1, SQLDT_USHORT, &hd->hskill[i].lv, 0);
- if( SQL_ERROR == SqlStmt_Execute(stmt) )
+ SQL->StmtBindParam(stmt, 0, SQLDT_USHORT, &hd->hskill[i].id, 0);
+ SQL->StmtBindParam(stmt, 1, SQLDT_USHORT, &hd->hskill[i].lv, 0);
+ if( SQL_ERROR == SQL->StmtExecute(stmt) )
{
SqlStmt_ShowDebug(stmt);
- SqlStmt_Free(stmt);
+ SQL->StmtFree(stmt);
flag = false;
break;
}
}
}
- SqlStmt_Free(stmt);
+ SQL->StmtFree(stmt);
}
}
diff --git a/src/char/int_mail.c b/src/char/int_mail.c
index 9181b7db6..e4b88b5bf 100644
--- a/src/char/int_mail.c
+++ b/src/char/int_mail.c
@@ -122,20 +122,20 @@ int mail_savemessage(struct mail_message* msg)
dbUpdateUid(sql_handle);
// prepare and execute query
- stmt = SqlStmt_Malloc(sql_handle);
- if( SQL_SUCCESS != SqlStmt_PrepareStr(stmt, StrBuf->Value(&buf))
- || SQL_SUCCESS != SqlStmt_BindParam(stmt, 0, SQLDT_STRING, msg->send_name, strnlen(msg->send_name, NAME_LENGTH))
- || SQL_SUCCESS != SqlStmt_BindParam(stmt, 1, SQLDT_STRING, msg->dest_name, strnlen(msg->dest_name, NAME_LENGTH))
- || SQL_SUCCESS != SqlStmt_BindParam(stmt, 2, SQLDT_STRING, msg->title, strnlen(msg->title, MAIL_TITLE_LENGTH))
- || SQL_SUCCESS != SqlStmt_BindParam(stmt, 3, SQLDT_STRING, msg->body, strnlen(msg->body, MAIL_BODY_LENGTH))
- || SQL_SUCCESS != SqlStmt_Execute(stmt) )
+ stmt = SQL->StmtMalloc(sql_handle);
+ if( SQL_SUCCESS != SQL->StmtPrepareStr(stmt, StrBuf->Value(&buf))
+ || SQL_SUCCESS != SQL->StmtBindParam(stmt, 0, SQLDT_STRING, msg->send_name, strnlen(msg->send_name, NAME_LENGTH))
+ || SQL_SUCCESS != SQL->StmtBindParam(stmt, 1, SQLDT_STRING, msg->dest_name, strnlen(msg->dest_name, NAME_LENGTH))
+ || SQL_SUCCESS != SQL->StmtBindParam(stmt, 2, SQLDT_STRING, msg->title, strnlen(msg->title, MAIL_TITLE_LENGTH))
+ || SQL_SUCCESS != SQL->StmtBindParam(stmt, 3, SQLDT_STRING, msg->body, strnlen(msg->body, MAIL_BODY_LENGTH))
+ || SQL_SUCCESS != SQL->StmtExecute(stmt) )
{
SqlStmt_ShowDebug(stmt);
msg->id = 0;
} else
- msg->id = (int)SqlStmt_LastInsertId(stmt);
+ msg->id = (int)SQL->StmtLastInsertId(stmt);
- SqlStmt_Free(stmt);
+ SQL->StmtFree(stmt);
StrBuf->Destroy(&buf);
return msg->id;
diff --git a/src/char/int_quest.c b/src/char/int_quest.c
index d771543cc..af8f83a5d 100644
--- a/src/char/int_quest.c
+++ b/src/char/int_quest.c
@@ -26,7 +26,7 @@ int mapif_quests_fromsql(int char_id, struct quest questlog[])
struct quest tmp_quest;
SqlStmt * stmt;
- stmt = SqlStmt_Malloc(sql_handle);
+ stmt = SQL->StmtMalloc(sql_handle);
if( stmt == NULL )
{
SqlStmt_ShowDebug(stmt);
@@ -35,21 +35,21 @@ int mapif_quests_fromsql(int char_id, struct quest questlog[])
memset(&tmp_quest, 0, sizeof(struct quest));
- if( SQL_ERROR == SqlStmt_Prepare(stmt, "SELECT `quest_id`, `state`, `time`, `count1`, `count2`, `count3` FROM `%s` WHERE `char_id`=? LIMIT %d", quest_db, MAX_QUEST_DB)
- || SQL_ERROR == SqlStmt_BindParam(stmt, 0, SQLDT_INT, &char_id, 0)
- || SQL_ERROR == SqlStmt_Execute(stmt)
- || SQL_ERROR == SqlStmt_BindColumn(stmt, 0, SQLDT_INT, &tmp_quest.quest_id, 0, NULL, NULL)
- || SQL_ERROR == SqlStmt_BindColumn(stmt, 1, SQLDT_INT, &tmp_quest.state, 0, NULL, NULL)
- || SQL_ERROR == SqlStmt_BindColumn(stmt, 2, SQLDT_UINT, &tmp_quest.time, 0, NULL, NULL)
- || SQL_ERROR == SqlStmt_BindColumn(stmt, 3, SQLDT_INT, &tmp_quest.count[0], 0, NULL, NULL)
- || SQL_ERROR == SqlStmt_BindColumn(stmt, 4, SQLDT_INT, &tmp_quest.count[1], 0, NULL, NULL)
- || SQL_ERROR == SqlStmt_BindColumn(stmt, 5, SQLDT_INT, &tmp_quest.count[2], 0, NULL, NULL) )
+ if( SQL_ERROR == SQL->StmtPrepare(stmt, "SELECT `quest_id`, `state`, `time`, `count1`, `count2`, `count3` FROM `%s` WHERE `char_id`=? LIMIT %d", quest_db, MAX_QUEST_DB)
+ || SQL_ERROR == SQL->StmtBindParam(stmt, 0, SQLDT_INT, &char_id, 0)
+ || SQL_ERROR == SQL->StmtExecute(stmt)
+ || SQL_ERROR == SQL->StmtBindColumn(stmt, 0, SQLDT_INT, &tmp_quest.quest_id, 0, NULL, NULL)
+ || SQL_ERROR == SQL->StmtBindColumn(stmt, 1, SQLDT_INT, &tmp_quest.state, 0, NULL, NULL)
+ || SQL_ERROR == SQL->StmtBindColumn(stmt, 2, SQLDT_UINT, &tmp_quest.time, 0, NULL, NULL)
+ || SQL_ERROR == SQL->StmtBindColumn(stmt, 3, SQLDT_INT, &tmp_quest.count[0], 0, NULL, NULL)
+ || SQL_ERROR == SQL->StmtBindColumn(stmt, 4, SQLDT_INT, &tmp_quest.count[1], 0, NULL, NULL)
+ || SQL_ERROR == SQL->StmtBindColumn(stmt, 5, SQLDT_INT, &tmp_quest.count[2], 0, NULL, NULL) )
SqlStmt_ShowDebug(stmt);
- for( i = 0; i < MAX_QUEST_DB && SQL_SUCCESS == SqlStmt_NextRow(stmt); ++i )
+ for( i = 0; i < MAX_QUEST_DB && SQL_SUCCESS == SQL->StmtNextRow(stmt); ++i )
memcpy(&questlog[i], &tmp_quest, sizeof(tmp_quest));
- SqlStmt_Free(stmt);
+ SQL->StmtFree(stmt);
return i;
}
diff --git a/src/char/inter.c b/src/char/inter.c
index a9e9dece4..1ff2bca61 100644
--- a/src/char/inter.c
+++ b/src/char/inter.c
@@ -935,7 +935,7 @@ int mapif_disconnectplayer(int fd, int account_id, int char_id, int reason)
int check_ttl_wisdata_sub(DBKey key, DBData *data, va_list ap)
{
unsigned long tick;
- struct WisData *wd = iDB->data2ptr(data);
+ struct WisData *wd = DB->data2ptr(data);
tick = va_arg(ap, unsigned long);
if (DIFF_TICK(tick, wd->tick) > WISDATA_TTL && wis_delnum < WISDELLIST_MAX)
diff --git a/src/char/inter.h b/src/char/inter.h
index de27b0473..f6663813a 100644
--- a/src/char/inter.h
+++ b/src/char/inter.h
@@ -7,6 +7,7 @@
struct accreg;
#include "../common/sql.h"
+#include "char.h"
int inter_init_sql(const char *file);
void inter_final(void);
@@ -32,7 +33,7 @@ uint64 inter_chk_lastuid(int8 flag, uint64 value);
#define dbUpdateUid(handler_)\
{ \
uint64 unique_id_ = inter_chk_lastuid(0, 0); \
- if (unique_id_ && SQL_ERROR == SQL->Query(handler_, "UPDATE `interreg` SET `value`='%"PRIu64"' WHERE `varname`='unique_id'", unique_id_)) \
+ if (unique_id_ && SQL_ERROR == SQL->Query(handler_, "UPDATE `%s` SET `value`='%"PRIu64"' WHERE `varname`='unique_id'", interreg_db, unique_id_)) \
Sql_ShowDebug(handler_);\
}
#else
diff --git a/src/common/HPM.c b/src/common/HPM.c
index ed6151c95..9283360dc 100644
--- a/src/common/HPM.c
+++ b/src/common/HPM.c
@@ -264,7 +264,7 @@ void hplugins_share_defaults(void) {
HPM->share(&SERVER_TYPE,"SERVER_TYPE");
HPM->share((void*)get_svn_revision,"get_svn_revision");
HPM->share((void*)get_git_hash,"get_git_hash");
- HPM->share(iDB, "iDB");
+ HPM->share(DB, "DB");
HPM->share(iMalloc, "iMalloc");
/* socket */
HPM->share(RFIFOSKIP,"RFIFOSKIP");
diff --git a/src/common/core.c b/src/common/core.c
index d6cfff662..c53d2243b 100644
--- a/src/common/core.c
+++ b/src/common/core.c
@@ -322,7 +322,7 @@ int main (int argc, char **argv) {
Sql_Init();
rathread_init();
mempool_init();
- iDB->init();
+ DB->init();
signals_init();
#ifdef _WIN32
@@ -356,7 +356,7 @@ int main (int argc, char **argv) {
#endif
iTimer->final();
socket_final();
- iDB->final();
+ DB->final();
mempool_final();
rathread_final();
#endif
diff --git a/src/common/db.c b/src/common/db.c
index b1fe22a4a..561371787 100644
--- a/src/common/db.c
+++ b/src/common/db.c
@@ -2349,7 +2349,7 @@ DBHasher db_default_hash(DBType type)
DBReleaser db_default_release(DBType type, DBOptions options)
{
DB_COUNTSTAT(db_default_release);
- options = iDB->fix_options(type, options);
+ options = DB->fix_options(type, options);
if (options&DB_OPT_RELEASE_DATA) { // Release data, what about the key?
if (options&(DB_OPT_DUP_KEY|DB_OPT_RELEASE_KEY))
return &db_release_both; // Release both key and data
@@ -2416,7 +2416,7 @@ DBMap* db_alloc(const char *file, const char *func, int line, DBType type, DBOpt
#endif /* DB_ENABLE_STATS */
db = ers_alloc(db_alloc_ers, struct DBMap_impl);
- options = iDB->fix_options(type, options);
+ options = DB->fix_options(type, options);
/* Interface of the database */
db->vtable.iterator = db_obj_iterator;
db->vtable.exists = db_obj_exists;
@@ -2447,9 +2447,9 @@ DBMap* db_alloc(const char *file, const char *func, int line, DBType type, DBOpt
/* Other */
snprintf(ers_name, 50, "db_alloc:nodes:%s:%s:%d",func,file,line);
db->nodes = ers_new(sizeof(struct dbn),ers_name,ERS_OPT_WAIT|ERS_OPT_FREE_NAME);
- db->cmp = iDB->default_cmp(type);
- db->hash = iDB->default_hash(type);
- db->release = iDB->default_release(type, options);
+ db->cmp = DB->default_cmp(type);
+ db->hash = DB->default_hash(type);
+ db->release = DB->default_release(type, options);
for (i = 0; i < HASH_SIZE; i++)
db->ht[i] = NULL;
db->cache = NULL;
@@ -2830,22 +2830,22 @@ void linkdb_final( struct linkdb_node** head )
*head = NULL;
}
void db_defaults(void) {
- iDB = &iDB_s;
- iDB->alloc = db_alloc;
- iDB->custom_release = db_custom_release;
- iDB->data2i = db_data2i;
- iDB->data2ptr = db_data2ptr;
- iDB->data2ui = db_data2ui;
- iDB->default_cmp = db_default_cmp;
- iDB->default_hash = db_default_hash;
- iDB->default_release = db_default_release;
- iDB->final = db_final;
- iDB->fix_options = db_fix_options;
- iDB->i2data = db_i2data;
- iDB->i2key = db_i2key;
- iDB->init = db_init;
- iDB->ptr2data = db_ptr2data;
- iDB->str2key = db_str2key;
- iDB->ui2data = db_ui2data;
- iDB->ui2key = db_ui2key;
+ DB = &DB_s;
+ DB->alloc = db_alloc;
+ DB->custom_release = db_custom_release;
+ DB->data2i = db_data2i;
+ DB->data2ptr = db_data2ptr;
+ DB->data2ui = db_data2ui;
+ DB->default_cmp = db_default_cmp;
+ DB->default_hash = db_default_hash;
+ DB->default_release = db_default_release;
+ DB->final = db_final;
+ DB->fix_options = db_fix_options;
+ DB->i2data = db_i2data;
+ DB->i2key = db_i2key;
+ DB->init = db_init;
+ DB->ptr2data = db_ptr2data;
+ DB->str2key = db_str2key;
+ DB->ui2data = db_ui2data;
+ DB->ui2key = db_ui2key;
}
diff --git a/src/common/db.h b/src/common/db.h
index 8ad033cce..5a555b2fa 100644
--- a/src/common/db.h
+++ b/src/common/db.h
@@ -599,73 +599,73 @@ struct DBMap {
// For easy access to the common functions.
#define db_exists(db,k) ( (db)->exists((db),(k)) )
-#define idb_exists(db,k) ( (db)->exists((db),iDB->i2key(k)) )
-#define uidb_exists(db,k) ( (db)->exists((db),iDB->ui2key(k)) )
-#define strdb_exists(db,k) ( (db)->exists((db),iDB->str2key(k)) )
+#define idb_exists(db,k) ( (db)->exists((db),DB->i2key(k)) )
+#define uidb_exists(db,k) ( (db)->exists((db),DB->ui2key(k)) )
+#define strdb_exists(db,k) ( (db)->exists((db),DB->str2key(k)) )
// Get pointer-type data from DBMaps of various key types
-#define db_get(db,k) ( iDB->data2ptr((db)->get((db),(k))) )
-#define idb_get(db,k) ( iDB->data2ptr((db)->get((db),iDB->i2key(k))) )
-#define uidb_get(db,k) ( iDB->data2ptr((db)->get((db),iDB->ui2key(k))) )
-#define strdb_get(db,k) ( iDB->data2ptr((db)->get((db),iDB->str2key(k))) )
+#define db_get(db,k) ( DB->data2ptr((db)->get((db),(k))) )
+#define idb_get(db,k) ( DB->data2ptr((db)->get((db),DB->i2key(k))) )
+#define uidb_get(db,k) ( DB->data2ptr((db)->get((db),DB->ui2key(k))) )
+#define strdb_get(db,k) ( DB->data2ptr((db)->get((db),DB->str2key(k))) )
// Get int-type data from DBMaps of various key types
-#define db_iget(db,k) ( iDB->data2i((db)->get((db),(k))) )
-#define idb_iget(db,k) ( iDB->data2i((db)->get((db),iDB->i2key(k))) )
-#define uidb_iget(db,k) ( iDB->data2i((db)->get((db),iDB->ui2key(k))) )
-#define strdb_iget(db,k) ( iDB->data2i((db)->get((db),iDB->str2key(k))) )
+#define db_iget(db,k) ( DB->data2i((db)->get((db),(k))) )
+#define idb_iget(db,k) ( DB->data2i((db)->get((db),DB->i2key(k))) )
+#define uidb_iget(db,k) ( DB->data2i((db)->get((db),DB->ui2key(k))) )
+#define strdb_iget(db,k) ( DB->data2i((db)->get((db),DB->str2key(k))) )
// Get uint-type data from DBMaps of various key types
-#define db_uiget(db,k) ( iDB->data2ui((db)->get((db),(k))) )
-#define idb_uiget(db,k) ( iDB->data2ui((db)->get((db),iDB->i2key(k))) )
-#define uidb_uiget(db,k) ( iDB->data2ui((db)->get((db),iDB->ui2key(k))) )
-#define strdb_uiget(db,k) ( iDB->data2ui((db)->get((db),iDB->str2key(k))) )
+#define db_uiget(db,k) ( DB->data2ui((db)->get((db),(k))) )
+#define idb_uiget(db,k) ( DB->data2ui((db)->get((db),DB->i2key(k))) )
+#define uidb_uiget(db,k) ( DB->data2ui((db)->get((db),DB->ui2key(k))) )
+#define strdb_uiget(db,k) ( DB->data2ui((db)->get((db),DB->str2key(k))) )
// Put pointer-type data into DBMaps of various key types
-#define db_put(db,k,d) ( (db)->put((db),(k),iDB->ptr2data(d),NULL) )
-#define idb_put(db,k,d) ( (db)->put((db),iDB->i2key(k),iDB->ptr2data(d),NULL) )
-#define uidb_put(db,k,d) ( (db)->put((db),iDB->ui2key(k),iDB->ptr2data(d),NULL) )
-#define strdb_put(db,k,d) ( (db)->put((db),iDB->str2key(k),iDB->ptr2data(d),NULL) )
+#define db_put(db,k,d) ( (db)->put((db),(k),DB->ptr2data(d),NULL) )
+#define idb_put(db,k,d) ( (db)->put((db),DB->i2key(k),DB->ptr2data(d),NULL) )
+#define uidb_put(db,k,d) ( (db)->put((db),DB->ui2key(k),DB->ptr2data(d),NULL) )
+#define strdb_put(db,k,d) ( (db)->put((db),DB->str2key(k),DB->ptr2data(d),NULL) )
// Put int-type data into DBMaps of various key types
-#define db_iput(db,k,d) ( (db)->put((db),(k),iDB->i2data(d),NULL) )
-#define idb_iput(db,k,d) ( (db)->put((db),iDB->i2key(k),iDB->i2data(d),NULL) )
-#define uidb_iput(db,k,d) ( (db)->put((db),iDB->ui2key(k),iDB->i2data(d),NULL) )
-#define strdb_iput(db,k,d) ( (db)->put((db),iDB->str2key(k),iDB->i2data(d),NULL) )
+#define db_iput(db,k,d) ( (db)->put((db),(k),DB->i2data(d),NULL) )
+#define idb_iput(db,k,d) ( (db)->put((db),DB->i2key(k),DB->i2data(d),NULL) )
+#define uidb_iput(db,k,d) ( (db)->put((db),DB->ui2key(k),DB->i2data(d),NULL) )
+#define strdb_iput(db,k,d) ( (db)->put((db),DB->str2key(k),DB->i2data(d),NULL) )
// Put uint-type data into DBMaps of various key types
-#define db_uiput(db,k,d) ( (db)->put((db),(k),iDB->ui2data(d),NULL) )
-#define idb_uiput(db,k,d) ( (db)->put((db),iDB->i2key(k),iDB->ui2data(d),NULL) )
-#define uidb_uiput(db,k,d) ( (db)->put((db),iDB->ui2key(k),iDB->ui2data(d),NULL) )
-#define strdb_uiput(db,k,d) ( (db)->put((db),iDB->str2key(k),iDB->ui2data(d),NULL) )
+#define db_uiput(db,k,d) ( (db)->put((db),(k),DB->ui2data(d),NULL) )
+#define idb_uiput(db,k,d) ( (db)->put((db),DB->i2key(k),DB->ui2data(d),NULL) )
+#define uidb_uiput(db,k,d) ( (db)->put((db),DB->ui2key(k),DB->ui2data(d),NULL) )
+#define strdb_uiput(db,k,d) ( (db)->put((db),DB->str2key(k),DB->ui2data(d),NULL) )
// Remove entry from DBMaps of various key types
#define db_remove(db,k) ( (db)->remove((db),(k),NULL) )
-#define idb_remove(db,k) ( (db)->remove((db),iDB->i2key(k),NULL) )
-#define uidb_remove(db,k) ( (db)->remove((db),iDB->ui2key(k),NULL) )
-#define strdb_remove(db,k) ( (db)->remove((db),iDB->str2key(k),NULL) )
+#define idb_remove(db,k) ( (db)->remove((db),DB->i2key(k),NULL) )
+#define uidb_remove(db,k) ( (db)->remove((db),DB->ui2key(k),NULL) )
+#define strdb_remove(db,k) ( (db)->remove((db),DB->str2key(k),NULL) )
//These are discarding the possible vargs you could send to the function, so those
//that require vargs must not use these defines.
-#define db_ensure(db,k,f) ( iDB->data2ptr((db)->ensure((db),(k),(f))) )
-#define idb_ensure(db,k,f) ( iDB->data2ptr((db)->ensure((db),iDB->i2key(k),(f))) )
-#define uidb_ensure(db,k,f) ( iDB->data2ptr((db)->ensure((db),iDB->ui2key(k),(f))) )
-#define strdb_ensure(db,k,f) ( iDB->data2ptr((db)->ensure((db),iDB->str2key(k),(f))) )
+#define db_ensure(db,k,f) ( DB->data2ptr((db)->ensure((db),(k),(f))) )
+#define idb_ensure(db,k,f) ( DB->data2ptr((db)->ensure((db),DB->i2key(k),(f))) )
+#define uidb_ensure(db,k,f) ( DB->data2ptr((db)->ensure((db),DB->ui2key(k),(f))) )
+#define strdb_ensure(db,k,f) ( DB->data2ptr((db)->ensure((db),DB->str2key(k),(f))) )
// Database creation and destruction macros
-#define idb_alloc(opt) iDB->alloc(__FILE__,__func__,__LINE__,DB_INT,(opt),sizeof(int))
-#define uidb_alloc(opt) iDB->alloc(__FILE__,__func__,__LINE__,DB_UINT,(opt),sizeof(unsigned int))
-#define strdb_alloc(opt,maxlen) iDB->alloc(__FILE__,__func__,__LINE__,DB_STRING,(opt),(maxlen))
-#define stridb_alloc(opt,maxlen) iDB->alloc(__FILE__,__func__,__LINE__,DB_ISTRING,(opt),(maxlen))
+#define idb_alloc(opt) DB->alloc(__FILE__,__func__,__LINE__,DB_INT,(opt),sizeof(int))
+#define uidb_alloc(opt) DB->alloc(__FILE__,__func__,__LINE__,DB_UINT,(opt),sizeof(unsigned int))
+#define strdb_alloc(opt,maxlen) DB->alloc(__FILE__,__func__,__LINE__,DB_STRING,(opt),(maxlen))
+#define stridb_alloc(opt,maxlen) DB->alloc(__FILE__,__func__,__LINE__,DB_ISTRING,(opt),(maxlen))
#define db_destroy(db) ( (db)->destroy((db),NULL) )
// Other macros
#define db_clear(db) ( (db)->clear(db,NULL) )
#define db_size(db) ( (db)->size(db) )
#define db_iterator(db) ( (db)->iterator(db) )
-#define dbi_first(dbi) ( iDB->data2ptr((dbi)->first(dbi,NULL)) )
-#define dbi_last(dbi) ( iDB->data2ptr((dbi)->last(dbi,NULL)) )
-#define dbi_next(dbi) ( iDB->data2ptr((dbi)->next(dbi,NULL)) )
-#define dbi_prev(dbi) ( iDB->data2ptr((dbi)->prev(dbi,NULL)) )
+#define dbi_first(dbi) ( DB->data2ptr((dbi)->first(dbi,NULL)) )
+#define dbi_last(dbi) ( DB->data2ptr((dbi)->last(dbi,NULL)) )
+#define dbi_next(dbi) ( DB->data2ptr((dbi)->next(dbi,NULL)) )
+#define dbi_prev(dbi) ( DB->data2ptr((dbi)->prev(dbi,NULL)) )
#define dbi_remove(dbi) ( (dbi)->remove(dbi,NULL) )
#define dbi_exists(dbi) ( (dbi)->exists(dbi) )
#define dbi_destroy(dbi) ( (dbi)->destroy(dbi) )
@@ -867,9 +867,9 @@ void (*init) (void);
* @see #db_init(void)
*/
void (*final) (void);
-} iDB_s;
+} DB_s;
-struct db_interface *iDB;
+struct db_interface *DB;
void db_defaults(void);
// Link DB System - From jAthena
diff --git a/src/common/sql.c b/src/common/sql.c
index d4bea7c12..441b860da 100644
--- a/src/common/sql.c
+++ b/src/common/sql.c
@@ -116,9 +116,9 @@ int Sql_GetTimeout(Sql* self, uint32* out_timeout)
size_t len;
if( SQL_SUCCESS == SQL->NextRow(self) &&
SQL_SUCCESS == SQL->GetData(self, 1, &data, &len) ) {
- *out_timeout = (uint32)strtoul(data, NULL, 10);
- SQL->FreeResult(self);
- return SQL_SUCCESS;
+ *out_timeout = (uint32)strtoul(data, NULL, 10);
+ SQL->FreeResult(self);
+ return SQL_SUCCESS;
}
SQL->FreeResult(self);
}
@@ -447,7 +447,7 @@ static int Sql_P_BindSqlDataType(MYSQL_BIND* bind, enum SqlDataType buffer_type,
case SQLDT_NULL: bind->buffer_type = MYSQL_TYPE_NULL;
buffer_len = 0;// FIXME length = ? [FlavioJS]
break;
- // fixed size
+ // fixed size
case SQLDT_UINT8: bind->is_unsigned = 1;
case SQLDT_INT8: bind->buffer_type = MYSQL_TYPE_TINY;
buffer_len = 1;
@@ -464,7 +464,7 @@ static int Sql_P_BindSqlDataType(MYSQL_BIND* bind, enum SqlDataType buffer_type,
case SQLDT_INT64: bind->buffer_type = MYSQL_TYPE_LONGLONG;
buffer_len = 8;
break;
- // platform dependent size
+ // platform dependent size
case SQLDT_UCHAR: bind->is_unsigned = 1;
case SQLDT_CHAR: bind->buffer_type = Sql_P_SizeToMysqlIntType(sizeof(char));
buffer_len = sizeof(char);
@@ -485,14 +485,14 @@ static int Sql_P_BindSqlDataType(MYSQL_BIND* bind, enum SqlDataType buffer_type,
case SQLDT_LONGLONG: bind->buffer_type = Sql_P_SizeToMysqlIntType(sizeof(int64));
buffer_len = sizeof(int64);
break;
- // floating point
+ // floating point
case SQLDT_FLOAT: bind->buffer_type = MYSQL_TYPE_FLOAT;
buffer_len = 4;
break;
case SQLDT_DOUBLE: bind->buffer_type = MYSQL_TYPE_DOUBLE;
buffer_len = 8;
break;
- // other
+ // other
case SQLDT_STRING:
case SQLDT_ENUM: bind->buffer_type = MYSQL_TYPE_STRING;
break;
@@ -524,25 +524,25 @@ static void Sql_P_ShowDebugMysqlFieldInfo(const char* prefix, enum enum_field_ty
ShowDebug("%stype=%s%u, length=%d\n", prefix, sign, type, length);
return;
#define SHOW_DEBUG_OF(x) case x: type_string = #x; break
- SHOW_DEBUG_OF(MYSQL_TYPE_TINY);
- SHOW_DEBUG_OF(MYSQL_TYPE_SHORT);
- SHOW_DEBUG_OF(MYSQL_TYPE_LONG);
- SHOW_DEBUG_OF(MYSQL_TYPE_INT24);
- SHOW_DEBUG_OF(MYSQL_TYPE_LONGLONG);
- SHOW_DEBUG_OF(MYSQL_TYPE_DECIMAL);
- SHOW_DEBUG_OF(MYSQL_TYPE_FLOAT);
- SHOW_DEBUG_OF(MYSQL_TYPE_DOUBLE);
- SHOW_DEBUG_OF(MYSQL_TYPE_TIMESTAMP);
- SHOW_DEBUG_OF(MYSQL_TYPE_DATE);
- SHOW_DEBUG_OF(MYSQL_TYPE_TIME);
- SHOW_DEBUG_OF(MYSQL_TYPE_DATETIME);
- SHOW_DEBUG_OF(MYSQL_TYPE_YEAR);
- SHOW_DEBUG_OF(MYSQL_TYPE_STRING);
- SHOW_DEBUG_OF(MYSQL_TYPE_VAR_STRING);
- SHOW_DEBUG_OF(MYSQL_TYPE_BLOB);
- SHOW_DEBUG_OF(MYSQL_TYPE_SET);
- SHOW_DEBUG_OF(MYSQL_TYPE_ENUM);
- SHOW_DEBUG_OF(MYSQL_TYPE_NULL);
+ SHOW_DEBUG_OF(MYSQL_TYPE_TINY);
+ SHOW_DEBUG_OF(MYSQL_TYPE_SHORT);
+ SHOW_DEBUG_OF(MYSQL_TYPE_LONG);
+ SHOW_DEBUG_OF(MYSQL_TYPE_INT24);
+ SHOW_DEBUG_OF(MYSQL_TYPE_LONGLONG);
+ SHOW_DEBUG_OF(MYSQL_TYPE_DECIMAL);
+ SHOW_DEBUG_OF(MYSQL_TYPE_FLOAT);
+ SHOW_DEBUG_OF(MYSQL_TYPE_DOUBLE);
+ SHOW_DEBUG_OF(MYSQL_TYPE_TIMESTAMP);
+ SHOW_DEBUG_OF(MYSQL_TYPE_DATE);
+ SHOW_DEBUG_OF(MYSQL_TYPE_TIME);
+ SHOW_DEBUG_OF(MYSQL_TYPE_DATETIME);
+ SHOW_DEBUG_OF(MYSQL_TYPE_YEAR);
+ SHOW_DEBUG_OF(MYSQL_TYPE_STRING);
+ SHOW_DEBUG_OF(MYSQL_TYPE_VAR_STRING);
+ SHOW_DEBUG_OF(MYSQL_TYPE_BLOB);
+ SHOW_DEBUG_OF(MYSQL_TYPE_SET);
+ SHOW_DEBUG_OF(MYSQL_TYPE_ENUM);
+ SHOW_DEBUG_OF(MYSQL_TYPE_NULL);
#undef SHOW_DEBUG_TYPE_OF
}
ShowDebug("%stype=%s%s, length=%d%s\n", prefix, sign, type_string, length, length_postfix);
@@ -610,7 +610,7 @@ int SqlStmt_Prepare(SqlStmt* self, const char* query, ...)
va_list args;
va_start(args, query);
- res = SqlStmt_PrepareV(self, query, args);
+ res = SQL->StmtPrepareV(self, query, args);
va_end(args);
return res;
@@ -624,7 +624,7 @@ int SqlStmt_PrepareV(SqlStmt* self, const char* query, va_list args)
if( self == NULL )
return SQL_ERROR;
- SqlStmt_FreeResult(self);
+ SQL->StmtFreeResult(self);
StrBuf->Clear(&self->buf);
StrBuf->Vprintf(&self->buf, query, args);
if( mysql_stmt_prepare(self->stmt, StrBuf->Value(&self->buf), (unsigned long)StrBuf->Length(&self->buf)) )
@@ -646,7 +646,7 @@ int SqlStmt_PrepareStr(SqlStmt* self, const char* query)
if( self == NULL )
return SQL_ERROR;
- SqlStmt_FreeResult(self);
+ SQL->StmtFreeResult(self);
StrBuf->Clear(&self->buf);
StrBuf->AppendStr(&self->buf, query);
if( mysql_stmt_prepare(self->stmt, StrBuf->Value(&self->buf), (unsigned long)StrBuf->Length(&self->buf)) )
@@ -677,14 +677,14 @@ size_t SqlStmt_NumParams(SqlStmt* self)
int SqlStmt_BindParam(SqlStmt* self, size_t idx, enum SqlDataType buffer_type, void* buffer, size_t buffer_len)
{
if( self == NULL )
- return SQL_ERROR;
+ return SQL_ERROR;
if( !self->bind_params )
{// initialize the bindings
size_t i;
size_t count;
- count = SqlStmt_NumParams(self);
+ count = SQL->StmtNumParams(self);
if( self->max_params < count )
{
self->max_params = count;
@@ -709,7 +709,7 @@ int SqlStmt_Execute(SqlStmt* self)
if( self == NULL )
return SQL_ERROR;
- SqlStmt_FreeResult(self);
+ SQL->StmtFreeResult(self);
if( (self->bind_params && mysql_stmt_bind_param(self->stmt, self->params)) ||
mysql_stmt_execute(self->stmt) )
{
@@ -772,7 +772,7 @@ int SqlStmt_BindColumn(SqlStmt* self, size_t idx, enum SqlDataType buffer_type,
size_t i;
size_t cols;
- cols = SqlStmt_NumColumns(self);
+ cols = SQL->StmtNumColumns(self);
if( self->max_columns < cols )
{
self->max_columns = cols;
@@ -843,7 +843,7 @@ int SqlStmt_NextRow(SqlStmt* self)
}
// find truncated column
- cols = SqlStmt_NumColumns(self);
+ cols = SQL->StmtNumColumns(self);
for( i = 0; i < cols; ++i )
{
column = &self->columns[i];
@@ -868,7 +868,7 @@ int SqlStmt_NextRow(SqlStmt* self)
}
// propagate column lengths and clear unused parts of string/enum/blob buffers
- cols = SqlStmt_NumColumns(self);
+ cols = SQL->StmtNumColumns(self);
for( i = 0; i < cols; ++i )
{
length = self->column_lengths[i].length;
@@ -946,21 +946,21 @@ void SqlStmt_Free(SqlStmt* self)
void hercules_mysql_error_handler(unsigned int ecode) {
static unsigned int retry = 1;
switch( ecode ) {
- case 2003:/* Can't connect to MySQL (this error only happens here when failing to reconnect) */
- if( mysql_reconnect_type == 1 ) {
- if( ++retry > mysql_reconnect_count ) {
- ShowFatalError("MySQL has been unreachable for too long, %d reconnects were attempted. Shutting Down\n", retry);
- exit(EXIT_FAILURE);
- }
+ case 2003:/* Can't connect to MySQL (this error only happens here when failing to reconnect) */
+ if( mysql_reconnect_type == 1 ) {
+ if( ++retry > mysql_reconnect_count ) {
+ ShowFatalError("MySQL has been unreachable for too long, %d reconnects were attempted. Shutting Down\n", retry);
+ exit(EXIT_FAILURE);
}
- break;
+ }
+ break;
}
}
void Sql_inter_server_read(const char* cfgName, bool first) {
int i;
char line[1024], w1[1024], w2[1024];
FILE* fp;
-
+
fp = fopen(cfgName, "r");
if(fp == NULL) {
if( first ) {
@@ -970,22 +970,22 @@ void Sql_inter_server_read(const char* cfgName, bool first) {
ShowError("File not found: %s\n", cfgName);
return;
}
-
+
while(fgets(line, sizeof(line), fp)) {
i = sscanf(line, "%[^:]: %[^\r\n]", w1, w2);
if(i != 2)
continue;
-
+
if(!strcmpi(w1,"mysql_reconnect_type")) {
mysql_reconnect_type = atoi(w2);
switch( mysql_reconnect_type ) {
- case 1:
- case 2:
- break;
- default:
- ShowError("%s::mysql_reconnect_type is set to %d which is not valid, defaulting to 1...\n", cfgName, mysql_reconnect_type);
- mysql_reconnect_type = 1;
- break;
+ case 1:
+ case 2:
+ break;
+ default:
+ ShowError("%s::mysql_reconnect_type is set to %d which is not valid, defaulting to 1...\n", cfgName, mysql_reconnect_type);
+ mysql_reconnect_type = 1;
+ break;
}
} else if(!strcmpi(w1,"mysql_reconnect_count")) {
mysql_reconnect_count = atoi(w2);
@@ -995,7 +995,7 @@ void Sql_inter_server_read(const char* cfgName, bool first) {
Sql_inter_server_read(w2,false);
}
fclose(fp);
-
+
return;
}
@@ -1003,7 +1003,7 @@ void Sql_HerculesUpdateCheck(Sql* self) {
char line[22];// "yyyy-mm-dd--hh-mm" (17) + ".sql" (4) + 1
FILE* ifp;/* index fp */
unsigned int performed = 0;
-
+
if( !( ifp = fopen("sql-files/upgrades/index.txt", "r") ) ) {
ShowError("SQL upgrade index was not found!\n");
return;
@@ -1013,22 +1013,22 @@ void Sql_HerculesUpdateCheck(Sql* self) {
char path[41];// "sql-files/upgrades/" (19) + "yyyy-mm-dd--hh-mm" (17) + ".sql" (4) + 1
char timestamp[11];// "1360186680" (10) + 1
FILE* ufp;/* upgrade fp */
-
+
if( line[0] == '\n' || ( line[0] == '/' && line[1] == '/' ) )/* skip \n and "//" comments */
continue;
-
+
sprintf(path,"sql-files/upgrades/%s",line);
-
+
if( !( ufp = fopen(path, "r") ) ) {
ShowError("SQL upgrade file %s was not found!\n",path);
continue;
}
-
+
if( fgetc(ufp) != '#' )
continue;
-
+
fseek (ufp,1,SEEK_SET);/* woo. skip the # */
-
+
if( fgets(timestamp,sizeof(timestamp),ufp) ) {
unsigned int timestampui = atol(timestamp);
if( SQL_ERROR == SQL->Query(self, "SELECT 1 FROM `sql_updates` WHERE `timestamp` = '%u' LIMIT 1", timestampui) )
@@ -1038,12 +1038,12 @@ void Sql_HerculesUpdateCheck(Sql* self) {
performed++;
}
}
-
+
fclose(ufp);
}
-
+
fclose(ifp);
-
+
if( performed ) {
ShowSQL("If you did apply these updates or would like to be skip, insert a new entry in your sql_updates table with the timestamp of each file\n");
}
@@ -1054,7 +1054,7 @@ void Sql_Init(void) {
}
void sql_defaults(void) {
SQL = &sql_s;
-
+
SQL->Connect = Sql_Connect;
SQL->GetTimeout = Sql_GetTimeout;
SQL->GetColumnNames = Sql_GetColumnNames;
@@ -1074,4 +1074,21 @@ void sql_defaults(void) {
SQL->ShowDebug_ = Sql_ShowDebug_;
SQL->Free = Sql_Free;
SQL->Malloc = Sql_Malloc;
+
+ /* SqlStmt defaults [Susu] */
+ SQL->StmtBindColumn = SqlStmt_BindColumn;
+ SQL->StmtBindParam = SqlStmt_BindParam;
+ SQL->StmtExecute = SqlStmt_Execute;
+ SQL->StmtFree = SqlStmt_Free;
+ SQL->StmtFreeResult = SqlStmt_FreeResult;
+ SQL->StmtLastInsertId = SqlStmt_LastInsertId;
+ SQL->StmtMalloc = SqlStmt_Malloc;
+ SQL->StmtNextRow = SqlStmt_NextRow;
+ SQL->StmtNumColumns = SqlStmt_NumColumns;
+ SQL->StmtNumParams = SqlStmt_NumParams;
+ SQL->StmtNumRows = SqlStmt_NumRows;
+ SQL->StmtPrepare = SqlStmt_Prepare;
+ SQL->StmtPrepareStr = SqlStmt_PrepareStr;
+ SQL->StmtPrepareV = SqlStmt_PrepareV;
+ SQL->StmtShowDebug_ = SqlStmt_ShowDebug_;
}
diff --git a/src/common/sql.h b/src/common/sql.h
index d5a0eda2c..535990649 100644
--- a/src/common/sql.h
+++ b/src/common/sql.h
@@ -142,145 +142,157 @@ struct sql_interface {
void (*Free) (Sql* self);
/// Allocates and initializes a new Sql handle.
struct Sql *(*Malloc) (void);
-} sql_s;
-struct sql_interface *SQL;
-void sql_defaults(void);
-#if defined(SQL_REMOVE_SHOWDEBUG)
- #define Sql_ShowDebug(self) (void)0
-#else
- #define Sql_ShowDebug(self) SQL->ShowDebug_(self, __FILE__, __LINE__)
-#endif
+ ///////////////////////////////////////////////////////////////////////////////
+ // Prepared Statements
+ ///////////////////////////////////////////////////////////////////////////////
+ // Parameters are placed in the statement by embedding question mark ('?')
+ // characters into the query at the appropriate positions.
+ // The markers are legal only in places where they represent data.
+ // The markers cannot be inside quotes. Quotes will be added automatically
+ // when they are required.
+ //
+ // example queries with parameters:
+ // 1) SELECT col FROM table WHERE id=?
+ // 2) INSERT INTO table(col1,col2) VALUES(?,?)
-///////////////////////////////////////////////////////////////////////////////
-// Prepared Statements
-///////////////////////////////////////////////////////////////////////////////
-// Parameters are placed in the statement by embedding question mark ('?')
-// characters into the query at the appropriate positions.
-// The markers are legal only in places where they represent data.
-// The markers cannot be inside quotes. Quotes will be added automatically
-// when they are required.
-//
-// example queries with parameters:
-// 1) SELECT col FROM table WHERE id=?
-// 2) INSERT INTO table(col1,col2) VALUES(?,?)
-/// Allocates and initializes a new SqlStmt handle.
-/// It uses the connection of the parent Sql handle.
-/// Queries in Sql and SqlStmt are independent and don't affect each other.
-///
-/// @return SqlStmt handle or NULL if an error occured
-struct SqlStmt* SqlStmt_Malloc(Sql* sql);
+ /*=====================================
+ SQL Statement interface [Susu]
+ *-------------------------------------*/
+ /// Allocates and initializes a new SqlStmt handle.
+ /// It uses the connection of the parent Sql handle.
+ /// Queries in Sql and SqlStmt are independent and don't affect each other.
+ ///
+ /// @return SqlStmt handle or NULL if an error occured
+ struct SqlStmt* (*StmtMalloc)(Sql* sql);
-/// Prepares the statement.
-/// Any previous result is freed and all parameter bindings are removed.
-/// The query is constructed as if it was sprintf.
-///
-/// @return SQL_SUCCESS or SQL_ERROR
-int SqlStmt_Prepare(SqlStmt* self, const char* query, ...);
-/// Prepares the statement.
-/// Any previous result is freed and all parameter bindings are removed.
-/// The query is constructed as if it was svprintf.
-///
-/// @return SQL_SUCCESS or SQL_ERROR
-int SqlStmt_PrepareV(SqlStmt* self, const char* query, va_list args);
+ /// Prepares the statement.
+ /// Any previous result is freed and all parameter bindings are removed.
+ /// The query is constructed as if it was sprintf.
+ ///
+ /// @return SQL_SUCCESS or SQL_ERROR
+ int (*StmtPrepare)(SqlStmt* self, const char* query, ...);
+ /// Prepares the statement.
+ /// Any previous result is freed and all parameter bindings are removed.
+ /// The query is constructed as if it was svprintf.
+ ///
+ /// @return SQL_SUCCESS or SQL_ERROR
+ int (*StmtPrepareV)(SqlStmt* self, const char* query, va_list args);
-/// Prepares the statement.
-/// Any previous result is freed and all parameter bindings are removed.
-/// The query is used directly.
-///
-/// @return SQL_SUCCESS or SQL_ERROR
-int SqlStmt_PrepareStr(SqlStmt* self, const char* query);
+ /// Prepares the statement.
+ /// Any previous result is freed and all parameter bindings are removed.
+ /// The query is used directly.
+ ///
+ /// @return SQL_SUCCESS or SQL_ERROR
+ int (*StmtPrepareStr)(SqlStmt* self, const char* query);
-/// Returns the number of parameters in the prepared statement.
-///
-/// @return Number or paramenters
-size_t SqlStmt_NumParams(SqlStmt* self);
+ /// Returns the number of parameters in the prepared statement.
+ ///
+ /// @return Number or paramenters
+ size_t (*StmtNumParams)(SqlStmt* self);
-/// Binds a parameter to a buffer.
-/// The buffer data will be used when the statement is executed.
-/// All parameters should have bindings.
-///
-/// @return SQL_SUCCESS or SQL_ERROR
-int SqlStmt_BindParam(SqlStmt* self, size_t idx, SqlDataType buffer_type, void* buffer, size_t buffer_len);
+ /// Binds a parameter to a buffer.
+ /// The buffer data will be used when the statement is executed.
+ /// All parameters should have bindings.
+ ///
+ /// @return SQL_SUCCESS or SQL_ERROR
+ int (*StmtBindParam)(SqlStmt* self, size_t idx, SqlDataType buffer_type, void* buffer, size_t buffer_len);
-/// Executes the prepared statement.
-/// Any previous result is freed and all column bindings are removed.
-///
-/// @return SQL_SUCCESS or SQL_ERROR
-int SqlStmt_Execute(SqlStmt* self);
+ /// Executes the prepared statement.
+ /// Any previous result is freed and all column bindings are removed.
+ ///
+ /// @return SQL_SUCCESS or SQL_ERROR
+ int (*StmtExecute)(SqlStmt* self);
-/// Returns the number of the AUTO_INCREMENT column of the last INSERT/UPDATE statement.
-///
-/// @return Value of the auto-increment column
-uint64 SqlStmt_LastInsertId(SqlStmt* self);
+ /// Returns the number of the AUTO_INCREMENT column of the last INSERT/UPDATE statement.
+ ///
+ /// @return Value of the auto-increment column
+ uint64 (*StmtLastInsertId)(SqlStmt* self);
-/// Returns the number of columns in each row of the result.
-///
-/// @return Number of columns
-size_t SqlStmt_NumColumns(SqlStmt* self);
+ /// Returns the number of columns in each row of the result.
+ ///
+ /// @return Number of columns
+ size_t (*StmtNumColumns)(SqlStmt* self);
+
+
+
+ /// Binds the result of a column to a buffer.
+ /// The buffer will be filled with data when the next row is fetched.
+ /// For string/enum buffer types there has to be enough space for the data
+ /// and the nul-terminator (an extra byte).
+ ///
+ /// @return SQL_SUCCESS or SQL_ERROR
+ int (*StmtBindColumn)(SqlStmt* self, size_t idx, SqlDataType buffer_type, void* buffer, size_t buffer_len, uint32* out_length, int8* out_is_null);
+
+
+
+ /// Returns the number of rows in the result.
+ ///
+ /// @return Number of rows
+ uint64 (*StmtNumRows)(SqlStmt* self);
-/// Binds the result of a column to a buffer.
-/// The buffer will be filled with data when the next row is fetched.
-/// For string/enum buffer types there has to be enough space for the data
-/// and the nul-terminator (an extra byte).
-///
-/// @return SQL_SUCCESS or SQL_ERROR
-int SqlStmt_BindColumn(SqlStmt* self, size_t idx, SqlDataType buffer_type, void* buffer, size_t buffer_len, uint32* out_length, int8* out_is_null);
+ /// Fetches the next row.
+ /// All column bindings will be filled with data.
+ ///
+ /// @return SQL_SUCCESS, SQL_ERROR or SQL_NO_DATA
+ int (*StmtNextRow)(SqlStmt* self);
-/// Returns the number of rows in the result.
-///
-/// @return Number of rows
-uint64 SqlStmt_NumRows(SqlStmt* self);
+ /// Frees the result of the statement execution.
+ void (*StmtFreeResult)(SqlStmt* self);
+ /// Frees a SqlStmt returned by SqlStmt_Malloc.
+ void (*StmtFree)(SqlStmt* self);
-/// Fetches the next row.
-/// All column bindings will be filled with data.
-///
-/// @return SQL_SUCCESS, SQL_ERROR or SQL_NO_DATA
-int SqlStmt_NextRow(SqlStmt* self);
+ void (*StmtShowDebug_)(SqlStmt* self, const char* debug_file, const unsigned long debug_line);
+} sql_s;
+
+struct sql_interface *SQL;
+void sql_defaults(void);
-/// Frees the result of the statement execution.
-void SqlStmt_FreeResult(SqlStmt* self);
+#if defined(SQL_REMOVE_SHOWDEBUG)
+#define Sql_ShowDebug(self) (void)0
+#else
+#define Sql_ShowDebug(self) SQL->ShowDebug_(self, __FILE__, __LINE__)
+#endif
void Sql_HerculesUpdateCheck(Sql* self);
#if defined(SQL_REMOVE_SHOWDEBUG)
- #define SqlStmt_ShowDebug(self) (void)0
+#define SqlStmt_ShowDebug(self) (void)0
#else
- #define SqlStmt_ShowDebug(self) SqlStmt_ShowDebug_(self, __FILE__, __LINE__)
+#define SqlStmt_ShowDebug(self) SQL->StmtShowDebug_(self, __FILE__, __LINE__)
#endif
/// Shows debug information (with statement).
-void SqlStmt_ShowDebug_(SqlStmt* self, const char* debug_file, const unsigned long debug_line);
-/// Frees a SqlStmt returned by SqlStmt_Malloc.
-void SqlStmt_Free(SqlStmt* self);
+
+
void Sql_Init(void);
diff --git a/src/common/timer.h b/src/common/timer.h
index d68b5ed0f..50f1c354b 100644
--- a/src/common/timer.h
+++ b/src/common/timer.h
@@ -1,10 +1,8 @@
// Copyright (c) Hercules Dev Team, licensed under GNU GPL.
// See the LICENSE file
// Portions Copyright (c) Athena Dev Teams
-
#ifndef _TIMER_H_
#define _TIMER_H_
-
#include "../common/cbasetypes.h"
#define DIFF_TICK(a,b) ((int)((a)-(b)))
@@ -34,7 +32,7 @@ struct TimerData {
intptr_t data;
};
-/* Hercules Renewal Phase One */
+
/*=====================================
* Interface : timer.h
* Generated by HerculesInterfaceMaker
diff --git a/src/config/const.h b/src/config/const.h
index 53f24da6f..756c681c1 100644
--- a/src/config/const.h
+++ b/src/config/const.h
@@ -92,7 +92,10 @@
#else
#define MAX_CARTS 5
#endif
-
+/* Client Supports Party Recruit or Party Booking? */
+#if (PACKETVER == 20120410) || (PACKETVER == 20120418)
+ #define PARTY_RECRUIT
+#endif
// Renewal variable cast time reduction
#ifdef RENEWAL_CAST
#define VARCAST_REDUCTION(val){ \
diff --git a/src/login/account_sql.c b/src/login/account_sql.c
index d3a7aafff..14dd8ad9d 100644
--- a/src/login/account_sql.c
+++ b/src/login/account_sql.c
@@ -583,7 +583,7 @@ static bool mmo_auth_fromsql(AccountDB_SQL* db, struct mmo_account* acc, int acc
static bool mmo_auth_tosql(AccountDB_SQL* db, const struct mmo_account* acc, bool is_new)
{
Sql* sql_handle = db->accounts;
- SqlStmt* stmt = SqlStmt_Malloc(sql_handle);
+ SqlStmt* stmt = SQL->StmtMalloc(sql_handle);
bool result = false;
int i;
@@ -599,48 +599,48 @@ static bool mmo_auth_tosql(AccountDB_SQL* db, const struct mmo_account* acc, boo
if( is_new )
{// insert into account table
- if( SQL_SUCCESS != SqlStmt_Prepare(stmt,
+ if( SQL_SUCCESS != SQL->StmtPrepare(stmt,
"INSERT INTO `%s` (`account_id`, `userid`, `user_pass`, `sex`, `email`, `group_id`, `state`, `unban_time`, `expiration_time`, `logincount`, `lastlogin`, `last_ip`, `birthdate`, `character_slots`, `pincode`, `pincode_change`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)",
db->account_db)
- || SQL_SUCCESS != SqlStmt_BindParam(stmt, 0, SQLDT_INT, (void*)&acc->account_id, sizeof(acc->account_id))
- || SQL_SUCCESS != SqlStmt_BindParam(stmt, 1, SQLDT_STRING, (void*)acc->userid, strlen(acc->userid))
- || SQL_SUCCESS != SqlStmt_BindParam(stmt, 2, SQLDT_STRING, (void*)acc->pass, strlen(acc->pass))
- || SQL_SUCCESS != SqlStmt_BindParam(stmt, 3, SQLDT_ENUM, (void*)&acc->sex, sizeof(acc->sex))
- || SQL_SUCCESS != SqlStmt_BindParam(stmt, 4, SQLDT_STRING, (void*)&acc->email, strlen(acc->email))
- || SQL_SUCCESS != SqlStmt_BindParam(stmt, 5, SQLDT_INT, (void*)&acc->group_id, sizeof(acc->group_id))
- || SQL_SUCCESS != SqlStmt_BindParam(stmt, 6, SQLDT_UINT, (void*)&acc->state, sizeof(acc->state))
- || SQL_SUCCESS != SqlStmt_BindParam(stmt, 7, SQLDT_LONG, (void*)&acc->unban_time, sizeof(acc->unban_time))
- || SQL_SUCCESS != SqlStmt_BindParam(stmt, 8, SQLDT_INT, (void*)&acc->expiration_time, sizeof(acc->expiration_time))
- || SQL_SUCCESS != SqlStmt_BindParam(stmt, 9, SQLDT_UINT, (void*)&acc->logincount, sizeof(acc->logincount))
- || SQL_SUCCESS != SqlStmt_BindParam(stmt, 10, SQLDT_STRING, (void*)&acc->lastlogin, strlen(acc->lastlogin))
- || SQL_SUCCESS != SqlStmt_BindParam(stmt, 11, SQLDT_STRING, (void*)&acc->last_ip, strlen(acc->last_ip))
- || SQL_SUCCESS != SqlStmt_BindParam(stmt, 12, SQLDT_STRING, (void*)&acc->birthdate, strlen(acc->birthdate))
- || SQL_SUCCESS != SqlStmt_BindParam(stmt, 13, SQLDT_UCHAR, (void*)&acc->char_slots, sizeof(acc->char_slots))
- || SQL_SUCCESS != SqlStmt_BindParam(stmt, 14, SQLDT_STRING, (void*)&acc->pincode, strlen(acc->pincode))
- || SQL_SUCCESS != SqlStmt_BindParam(stmt, 15, SQLDT_LONG, (void*)&acc->pincode_change, sizeof(acc->pincode_change))
- || SQL_SUCCESS != SqlStmt_Execute(stmt)
+ || SQL_SUCCESS != SQL->StmtBindParam(stmt, 0, SQLDT_INT, (void*)&acc->account_id, sizeof(acc->account_id))
+ || SQL_SUCCESS != SQL->StmtBindParam(stmt, 1, SQLDT_STRING, (void*)acc->userid, strlen(acc->userid))
+ || SQL_SUCCESS != SQL->StmtBindParam(stmt, 2, SQLDT_STRING, (void*)acc->pass, strlen(acc->pass))
+ || SQL_SUCCESS != SQL->StmtBindParam(stmt, 3, SQLDT_ENUM, (void*)&acc->sex, sizeof(acc->sex))
+ || SQL_SUCCESS != SQL->StmtBindParam(stmt, 4, SQLDT_STRING, (void*)&acc->email, strlen(acc->email))
+ || SQL_SUCCESS != SQL->StmtBindParam(stmt, 5, SQLDT_INT, (void*)&acc->group_id, sizeof(acc->group_id))
+ || SQL_SUCCESS != SQL->StmtBindParam(stmt, 6, SQLDT_UINT, (void*)&acc->state, sizeof(acc->state))
+ || SQL_SUCCESS != SQL->StmtBindParam(stmt, 7, SQLDT_LONG, (void*)&acc->unban_time, sizeof(acc->unban_time))
+ || SQL_SUCCESS != SQL->StmtBindParam(stmt, 8, SQLDT_INT, (void*)&acc->expiration_time, sizeof(acc->expiration_time))
+ || SQL_SUCCESS != SQL->StmtBindParam(stmt, 9, SQLDT_UINT, (void*)&acc->logincount, sizeof(acc->logincount))
+ || SQL_SUCCESS != SQL->StmtBindParam(stmt, 10, SQLDT_STRING, (void*)&acc->lastlogin, strlen(acc->lastlogin))
+ || SQL_SUCCESS != SQL->StmtBindParam(stmt, 11, SQLDT_STRING, (void*)&acc->last_ip, strlen(acc->last_ip))
+ || SQL_SUCCESS != SQL->StmtBindParam(stmt, 12, SQLDT_STRING, (void*)&acc->birthdate, strlen(acc->birthdate))
+ || SQL_SUCCESS != SQL->StmtBindParam(stmt, 13, SQLDT_UCHAR, (void*)&acc->char_slots, sizeof(acc->char_slots))
+ || SQL_SUCCESS != SQL->StmtBindParam(stmt, 14, SQLDT_STRING, (void*)&acc->pincode, strlen(acc->pincode))
+ || SQL_SUCCESS != SQL->StmtBindParam(stmt, 15, SQLDT_LONG, (void*)&acc->pincode_change, sizeof(acc->pincode_change))
+ || SQL_SUCCESS != SQL->StmtExecute(stmt)
) {
SqlStmt_ShowDebug(stmt);
break;
}
} else {// update account table
- if( SQL_SUCCESS != SqlStmt_Prepare(stmt, "UPDATE `%s` SET `userid`=?,`user_pass`=?,`sex`=?,`email`=?,`group_id`=?,`state`=?,`unban_time`=?,`expiration_time`=?,`logincount`=?,`lastlogin`=?,`last_ip`=?,`birthdate`=?,`character_slots`=?,`pincode`=?,`pincode_change`=? WHERE `account_id` = '%d'", db->account_db, acc->account_id)
- || SQL_SUCCESS != SqlStmt_BindParam(stmt, 0, SQLDT_STRING, (void*)acc->userid, strlen(acc->userid))
- || SQL_SUCCESS != SqlStmt_BindParam(stmt, 1, SQLDT_STRING, (void*)acc->pass, strlen(acc->pass))
- || SQL_SUCCESS != SqlStmt_BindParam(stmt, 2, SQLDT_ENUM, (void*)&acc->sex, sizeof(acc->sex))
- || SQL_SUCCESS != SqlStmt_BindParam(stmt, 3, SQLDT_STRING, (void*)acc->email, strlen(acc->email))
- || SQL_SUCCESS != SqlStmt_BindParam(stmt, 4, SQLDT_INT, (void*)&acc->group_id, sizeof(acc->group_id))
- || SQL_SUCCESS != SqlStmt_BindParam(stmt, 5, SQLDT_UINT, (void*)&acc->state, sizeof(acc->state))
- || SQL_SUCCESS != SqlStmt_BindParam(stmt, 6, SQLDT_LONG, (void*)&acc->unban_time, sizeof(acc->unban_time))
- || SQL_SUCCESS != SqlStmt_BindParam(stmt, 7, SQLDT_LONG, (void*)&acc->expiration_time, sizeof(acc->expiration_time))
- || SQL_SUCCESS != SqlStmt_BindParam(stmt, 8, SQLDT_UINT, (void*)&acc->logincount, sizeof(acc->logincount))
- || SQL_SUCCESS != SqlStmt_BindParam(stmt, 9, SQLDT_STRING, (void*)&acc->lastlogin, strlen(acc->lastlogin))
- || SQL_SUCCESS != SqlStmt_BindParam(stmt, 10, SQLDT_STRING, (void*)&acc->last_ip, strlen(acc->last_ip))
- || SQL_SUCCESS != SqlStmt_BindParam(stmt, 11, SQLDT_STRING, (void*)&acc->birthdate, strlen(acc->birthdate))
- || SQL_SUCCESS != SqlStmt_BindParam(stmt, 12, SQLDT_UCHAR, (void*)&acc->char_slots, sizeof(acc->char_slots))
- || SQL_SUCCESS != SqlStmt_BindParam(stmt, 13, SQLDT_STRING, (void*)&acc->pincode, strlen(acc->pincode))
- || SQL_SUCCESS != SqlStmt_BindParam(stmt, 14, SQLDT_LONG, (void*)&acc->pincode_change, sizeof(acc->pincode_change))
- || SQL_SUCCESS != SqlStmt_Execute(stmt)
+ if( SQL_SUCCESS != SQL->StmtPrepare(stmt, "UPDATE `%s` SET `userid`=?,`user_pass`=?,`sex`=?,`email`=?,`group_id`=?,`state`=?,`unban_time`=?,`expiration_time`=?,`logincount`=?,`lastlogin`=?,`last_ip`=?,`birthdate`=?,`character_slots`=?,`pincode`=?,`pincode_change`=? WHERE `account_id` = '%d'", db->account_db, acc->account_id)
+ || SQL_SUCCESS != SQL->StmtBindParam(stmt, 0, SQLDT_STRING, (void*)acc->userid, strlen(acc->userid))
+ || SQL_SUCCESS != SQL->StmtBindParam(stmt, 1, SQLDT_STRING, (void*)acc->pass, strlen(acc->pass))
+ || SQL_SUCCESS != SQL->StmtBindParam(stmt, 2, SQLDT_ENUM, (void*)&acc->sex, sizeof(acc->sex))
+ || SQL_SUCCESS != SQL->StmtBindParam(stmt, 3, SQLDT_STRING, (void*)acc->email, strlen(acc->email))
+ || SQL_SUCCESS != SQL->StmtBindParam(stmt, 4, SQLDT_INT, (void*)&acc->group_id, sizeof(acc->group_id))
+ || SQL_SUCCESS != SQL->StmtBindParam(stmt, 5, SQLDT_UINT, (void*)&acc->state, sizeof(acc->state))
+ || SQL_SUCCESS != SQL->StmtBindParam(stmt, 6, SQLDT_LONG, (void*)&acc->unban_time, sizeof(acc->unban_time))
+ || SQL_SUCCESS != SQL->StmtBindParam(stmt, 7, SQLDT_LONG, (void*)&acc->expiration_time, sizeof(acc->expiration_time))
+ || SQL_SUCCESS != SQL->StmtBindParam(stmt, 8, SQLDT_UINT, (void*)&acc->logincount, sizeof(acc->logincount))
+ || SQL_SUCCESS != SQL->StmtBindParam(stmt, 9, SQLDT_STRING, (void*)&acc->lastlogin, strlen(acc->lastlogin))
+ || SQL_SUCCESS != SQL->StmtBindParam(stmt, 10, SQLDT_STRING, (void*)&acc->last_ip, strlen(acc->last_ip))
+ || SQL_SUCCESS != SQL->StmtBindParam(stmt, 11, SQLDT_STRING, (void*)&acc->birthdate, strlen(acc->birthdate))
+ || SQL_SUCCESS != SQL->StmtBindParam(stmt, 12, SQLDT_UCHAR, (void*)&acc->char_slots, sizeof(acc->char_slots))
+ || SQL_SUCCESS != SQL->StmtBindParam(stmt, 13, SQLDT_STRING, (void*)&acc->pincode, strlen(acc->pincode))
+ || SQL_SUCCESS != SQL->StmtBindParam(stmt, 14, SQLDT_LONG, (void*)&acc->pincode_change, sizeof(acc->pincode_change))
+ || SQL_SUCCESS != SQL->StmtExecute(stmt)
) {
SqlStmt_ShowDebug(stmt);
break;
@@ -654,16 +654,16 @@ static bool mmo_auth_tosql(AccountDB_SQL* db, const struct mmo_account* acc, boo
break;
}
// insert new account regs
- if( SQL_SUCCESS != SqlStmt_Prepare(stmt, "INSERT INTO `%s` (`type`, `account_id`, `str`, `value`) VALUES ( 1 , '%d' , ? , ? );", db->accreg_db, acc->account_id) )
+ if( SQL_SUCCESS != SQL->StmtPrepare(stmt, "INSERT INTO `%s` (`type`, `account_id`, `str`, `value`) VALUES ( 1 , '%d' , ? , ? );", db->accreg_db, acc->account_id) )
{
SqlStmt_ShowDebug(stmt);
break;
}
for( i = 0; i < acc->account_reg2_num; ++i )
{
- if( SQL_SUCCESS != SqlStmt_BindParam(stmt, 0, SQLDT_STRING, (void*)acc->account_reg2[i].str, strlen(acc->account_reg2[i].str))
- || SQL_SUCCESS != SqlStmt_BindParam(stmt, 1, SQLDT_STRING, (void*)acc->account_reg2[i].value, strlen(acc->account_reg2[i].value))
- || SQL_SUCCESS != SqlStmt_Execute(stmt)
+ if( SQL_SUCCESS != SQL->StmtBindParam(stmt, 0, SQLDT_STRING, (void*)acc->account_reg2[i].str, strlen(acc->account_reg2[i].str))
+ || SQL_SUCCESS != SQL->StmtBindParam(stmt, 1, SQLDT_STRING, (void*)acc->account_reg2[i].value, strlen(acc->account_reg2[i].value))
+ || SQL_SUCCESS != SQL->StmtExecute(stmt)
) {
SqlStmt_ShowDebug(stmt);
break;
@@ -682,7 +682,7 @@ static bool mmo_auth_tosql(AccountDB_SQL* db, const struct mmo_account* acc, boo
// finally
result &= ( SQL_SUCCESS == SQL->QueryStr(sql_handle, (result == true) ? "COMMIT" : "ROLLBACK") );
- SqlStmt_Free(stmt);
+ SQL->StmtFree(stmt);
return result;
}
diff --git a/src/login/login.c b/src/login/login.c
index 159d99fee..e8f136ba9 100644
--- a/src/login/login.c
+++ b/src/login/login.c
@@ -109,7 +109,7 @@ static DBData create_online_user(DBKey key, va_list args)
p->account_id = key.i;
p->char_server = -1;
p->waiting_disconnect = INVALID_TIMER;
- return iDB->ptr2data(p);
+ return DB->ptr2data(p);
}
struct online_login_data* add_online_user(int char_server, int account_id)
@@ -154,7 +154,7 @@ static int waiting_disconnect_timer(int tid, unsigned int tick, int id, intptr_t
*/
static int online_db_setoffline(DBKey key, DBData *data, va_list ap)
{
- struct online_login_data* p = iDB->data2ptr(data);
+ struct online_login_data* p = DB->data2ptr(data);
int server = va_arg(ap, int);
if( server == -1 )
{
@@ -175,7 +175,7 @@ static int online_db_setoffline(DBKey key, DBData *data, va_list ap)
*/
static int online_data_cleanup_sub(DBKey key, DBData *data, va_list ap)
{
- struct online_login_data *character= iDB->data2ptr(data);
+ struct online_login_data *character= DB->data2ptr(data);
if (character->char_server == -2) //Unknown server.. set them offline
remove_online_user(character->account_id);
return 0;
diff --git a/src/map/atcommand.c b/src/map/atcommand.c
index f0e5e34d3..f96c7920a 100644
--- a/src/map/atcommand.c
+++ b/src/map/atcommand.c
@@ -410,8 +410,8 @@ ACMD(mapmove)
return false;
}
- if ((x || y) && iMap->getcell(m, x, y, CELL_CHKNOPASS) && iPc->get_group_level(sd) < battle_config.gm_ignore_warpable_area)
- { //This is to prevent the iPc->setpos call from printing an error.
+ if ((x || y) && iMap->getcell(m, x, y, CELL_CHKNOPASS) && pc->get_group_level(sd) < battle_config.gm_ignore_warpable_area)
+ { //This is to prevent the pc->setpos call from printing an error.
clif->message(fd, msg_txt(2));
if (!iMap->search_freecell(NULL, m, &x, &y, 10, 10, 1))
x = y = 0; //Invalid cell, use random spot.
@@ -424,7 +424,7 @@ ACMD(mapmove)
clif->message(fd, msg_txt(248));
return false;
}
- if (iPc->setpos(sd, mapindex, x, y, CLR_TELEPORT) != 0) {
+ if (pc->setpos(sd, mapindex, x, y, CLR_TELEPORT) != 0) {
clif->message(fd, msg_txt(1)); // Map not found.
return false;
}
@@ -451,7 +451,7 @@ ACMD(where)
pl_sd = iMap->nick2sd(atcmd_player_name);
if (pl_sd == NULL ||
strncmp(pl_sd->status.name, atcmd_player_name, NAME_LENGTH) != 0 ||
- (pc_has_permission(pl_sd, PC_PERM_HIDE_SESSION) && iPc->get_group_level(pl_sd) > iPc->get_group_level(sd) && !pc_has_permission(sd, PC_PERM_WHO_DISPLAY_AID))
+ (pc_has_permission(pl_sd, PC_PERM_HIDE_SESSION) && pc->get_group_level(pl_sd) > pc->get_group_level(sd) && !pc_has_permission(sd, PC_PERM_WHO_DISPLAY_AID))
) {
clif->message(fd, msg_txt(3)); // Character not found.
return false;
@@ -501,7 +501,7 @@ ACMD(jumpto)
return false;
}
- iPc->setpos(sd, pl_sd->mapindex, pl_sd->bl.x, pl_sd->bl.y, CLR_TELEPORT);
+ pc->setpos(sd, pl_sd->mapindex, pl_sd->bl.x, pl_sd->bl.y, CLR_TELEPORT);
sprintf(atcmd_output, msg_txt(4), pl_sd->status.name); // Jumped to %s
clif->message(fd, atcmd_output);
@@ -533,13 +533,13 @@ ACMD(jump)
}
if ((x || y) && iMap->getcell(sd->bl.m, x, y, CELL_CHKNOPASS))
- { //This is to prevent the iPc->setpos call from printing an error.
+ { //This is to prevent the pc->setpos call from printing an error.
clif->message(fd, msg_txt(2));
if (!iMap->search_freecell(NULL, sd->bl.m, &x, &y, 10, 10, 1))
x = y = 0; //Invalid cell, use random spot.
}
- iPc->setpos(sd, sd->mapindex, x, y, CLR_TELEPORT);
+ pc->setpos(sd, sd->mapindex, x, y, CLR_TELEPORT);
sprintf(atcmd_output, msg_txt(5), sd->bl.x, sd->bl.y); // Jumped to %d %d
clif->message(fd, atcmd_output);
return true;
@@ -580,12 +580,12 @@ ACMD(who)
else if (strstr(command, "3") != NULL)
display_type = 3;
- level = iPc->get_group_level(sd);
+ level = pc->get_group_level(sd);
StrBuf->Init(&buf);
iter = mapit_getallusers();
for (pl_sd = (TBL_PC*)mapit->first(iter); mapit->exists(iter); pl_sd = (TBL_PC*)mapit->next(iter)) {
- if (!((pc_has_permission(pl_sd, PC_PERM_HIDE_SESSION) || (pl_sd->sc.option & OPTION_INVISIBLE)) && iPc->get_group_level(pl_sd) > level)) { // you can look only lower or same level
+ if (!((pc_has_permission(pl_sd, PC_PERM_HIDE_SESSION) || (pl_sd->sc.option & OPTION_INVISIBLE)) && pc->get_group_level(pl_sd) > level)) { // you can look only lower or same level
if (stristr(pl_sd->status.name, player_name) == NULL // search with no case sensitive
|| (map_id >= 0 && pl_sd->bl.m != map_id))
continue;
@@ -595,7 +595,7 @@ ACMD(who)
if (pc_get_group_id(pl_sd) > 0) // Player title, if exists
StrBuf->Printf(&buf, msg_txt(344), pc_group_id2name(pc_get_group_id(pl_sd))); // "(%s) "
StrBuf->Printf(&buf, msg_txt(347), pl_sd->status.base_level, pl_sd->status.job_level,
- iPc->job_name(pl_sd->status.class_)); // "| Lv:%d/%d | Job: %s"
+ pc->job_name(pl_sd->status.class_)); // "| Lv:%d/%d | Job: %s"
break;
}
case 3: {
@@ -608,7 +608,7 @@ ACMD(who)
break;
}
default: {
- struct party_data *p = iParty->search(pl_sd->status.party_id);
+ struct party_data *p = party->search(pl_sd->status.party_id);
struct guild *g = pl_sd->guild;
StrBuf->Printf(&buf, msg_txt(343), pl_sd->status.name); // "Name: %s "
@@ -674,12 +674,12 @@ ACMD(whogm)
match_text[j] = TOLOWER(match_text[j]);
count = 0;
- level = iPc->get_group_level(sd);
+ level = pc->get_group_level(sd);
iter = mapit_getallusers();
for( pl_sd = (TBL_PC*)mapit->first(iter); mapit->exists(iter); pl_sd = (TBL_PC*)mapit->next(iter) )
{
- pl_level = iPc->get_group_level(pl_sd);
+ pl_level = pc->get_group_level(pl_sd);
if (!pl_level)
continue;
@@ -708,10 +708,10 @@ ACMD(whogm)
sprintf(atcmd_output, msg_txt(915), // BLvl: %d | Job: %s (Lvl: %d)
pl_sd->status.base_level,
- iPc->job_name(pl_sd->status.class_), pl_sd->status.job_level);
+ pc->job_name(pl_sd->status.class_), pl_sd->status.job_level);
clif->message(fd, atcmd_output);
- p = iParty->search(pl_sd->status.party_id);
+ p = party->search(pl_sd->status.party_id);
g = pl_sd->guild;
sprintf(atcmd_output,msg_txt(916), // Party: '%s' | Guild: '%s'
@@ -741,7 +741,7 @@ ACMD(save)
{
nullpo_retr(-1, sd);
- iPc->setsavepoint(sd, sd->mapindex, sd->bl.x, sd->bl.y);
+ pc->setsavepoint(sd, sd->mapindex, sd->bl.x, sd->bl.y);
if (sd->status.pet_id > 0 && sd->pd)
intif_save_petdata(sd->status.account_id, &sd->pd->pet);
@@ -771,7 +771,7 @@ ACMD(load)
return false;
}
- iPc->setpos(sd, sd->status.save_point.map, sd->status.save_point.x, sd->status.save_point.y, CLR_OUTSIGHT);
+ pc->setpos(sd, sd->status.save_point.map, sd->status.save_point.x, sd->status.save_point.y, CLR_OUTSIGHT);
clif->message(fd, msg_txt(7)); // Warping to save point..
return true;
@@ -885,7 +885,7 @@ ACMD(option)
sd->sc.opt1 = param1;
sd->sc.opt2 = param2;
- iPc->setoption(sd, param3);
+ pc->setoption(sd, param3);
clif->message(fd, msg_txt(9)); // Options changed.
@@ -911,7 +911,7 @@ ACMD(hide)
if( map[sd->bl.m].flag.pvp && !map[sd->bl.m].flag.pvp_nocalcrank )
{// register the player for ranking calculations
- sd->pvp_timer = iTimer->add_timer( iTimer->gettick() + 200, iPc->calc_pvprank_timer, sd->bl.id, 0 );
+ sd->pvp_timer = iTimer->add_timer( iTimer->gettick() + 200, pc->calc_pvprank_timer, sd->bl.id, 0 );
}
//bugreport:2266
iMap->foreachinmovearea(clif->insight, &sd->bl, AREA_SIZE, sd->bl.x, sd->bl.y, BL_ALL, &sd->bl);
@@ -925,7 +925,7 @@ ACMD(hide)
if( map[sd->bl.m].flag.pvp && !map[sd->bl.m].flag.pvp_nocalcrank && sd->pvp_timer != INVALID_TIMER )
{// unregister the player for ranking
- iTimer->delete_timer( sd->pvp_timer, iPc->calc_pvprank_timer );
+ iTimer->delete_timer( sd->pvp_timer, pc->calc_pvprank_timer );
sd->pvp_timer = INVALID_TIMER;
}
}
@@ -951,7 +951,7 @@ ACMD(jobchange)
// Normal Jobs
for( i = JOB_NOVICE; i < JOB_MAX_BASIC && !found; i++ ){
- if (strncmpi(message, iPc->job_name(i), 16) == 0) {
+ if (strncmpi(message, pc->job_name(i), 16) == 0) {
job = i;
found = true;
}
@@ -959,7 +959,7 @@ ACMD(jobchange)
// High Jobs, Babys and Third
for( i = JOB_NOVICE_HIGH; i < JOB_MAX && !found; i++ ){
- if (strncmpi(message, iPc->job_name(i), 16) == 0) {
+ if (strncmpi(message, pc->job_name(i), 16) == 0) {
job = i;
found = true;
}
@@ -982,7 +982,7 @@ ACMD(jobchange)
if (pcdb_checkid(job))
{
- if (iPc->jobchange(sd, job, upper) == 0)
+ if (pc->jobchange(sd, job, upper) == 0)
clif->message(fd, msg_txt(12)); // Your job has been changed.
else {
clif->message(fd, msg_txt(155)); // You are unable to change your job.
@@ -1166,7 +1166,7 @@ ACMD(item)
item_tmp.nameid = item_id;
item_tmp.identify = 1;
- if ((flag = iPc->additem(sd, &item_tmp, get_count, LOG_TYPE_COMMAND)))
+ if ((flag = pc->additem(sd, &item_tmp, get_count, LOG_TYPE_COMMAND)))
clif->additem(sd, 0, 0, flag);
}
}
@@ -1239,7 +1239,7 @@ ACMD(item2)
item_tmp.card[1] = c2;
item_tmp.card[2] = c3;
item_tmp.card[3] = c4;
- if ((flag = iPc->additem(sd, &item_tmp, get_count, LOG_TYPE_COMMAND)))
+ if ((flag = pc->additem(sd, &item_tmp, get_count, LOG_TYPE_COMMAND)))
clif->additem(sd, 0, 0, flag);
}
@@ -1263,7 +1263,7 @@ ACMD(itemreset)
for (i = 0; i < MAX_INVENTORY; i++) {
if (sd->status.inventory[i].amount && sd->status.inventory[i].equip == 0) {
- iPc->delitem(sd, i, sd->status.inventory[i].amount, 0, 0, LOG_TYPE_COMMAND);
+ pc->delitem(sd, i, sd->status.inventory[i].amount, 0, 0, LOG_TYPE_COMMAND);
}
}
clif->message(fd, msg_txt(20)); // All of your items have been removed.
@@ -1286,14 +1286,14 @@ ACMD(baselevelup)
}
if (level > 0) {
- if (sd->status.base_level >= iPc->maxbaselv(sd)) { // check for max level by Valaris
+ if (sd->status.base_level >= pc->maxbaselv(sd)) { // check for max level by Valaris
clif->message(fd, msg_txt(47)); // Base level can't go any higher.
return false;
} // End Addition
- if ((unsigned int)level > iPc->maxbaselv(sd) || (unsigned int)level > iPc->maxbaselv(sd) - sd->status.base_level) // fix positiv overflow
- level = iPc->maxbaselv(sd) - sd->status.base_level;
+ if ((unsigned int)level > pc->maxbaselv(sd) || (unsigned int)level > pc->maxbaselv(sd) - sd->status.base_level) // fix positiv overflow
+ level = pc->maxbaselv(sd) - sd->status.base_level;
for (i = 0; i < level; i++)
- status_point += iPc->gets_status_point(sd->status.base_level + i);
+ status_point += pc->gets_status_point(sd->status.base_level + i);
sd->status.status_point += status_point;
sd->status.base_level += (unsigned int)level;
@@ -1309,9 +1309,9 @@ ACMD(baselevelup)
if ((unsigned int)level >= sd->status.base_level)
level = sd->status.base_level-1;
for (i = 0; i > -level; i--)
- status_point += iPc->gets_status_point(sd->status.base_level + i - 1);
+ status_point += pc->gets_status_point(sd->status.base_level + i - 1);
if (sd->status.status_point < status_point)
- iPc->resetstate(sd);
+ pc->resetstate(sd);
if (sd->status.status_point < status_point)
sd->status.status_point = 0;
else
@@ -1325,9 +1325,9 @@ ACMD(baselevelup)
clif->updatestatus(sd, SP_BASEEXP);
clif->updatestatus(sd, SP_NEXTBASEEXP);
status_calc_pc(sd, 0);
- iPc->baselevelchanged(sd);
+ pc->baselevelchanged(sd);
if(sd->status.party_id)
- iParty->send_levelup(sd);
+ party->send_levelup(sd);
return true;
}
@@ -1346,12 +1346,12 @@ ACMD(joblevelup)
return false;
}
if (level > 0) {
- if (sd->status.job_level >= iPc->maxjoblv(sd)) {
+ if (sd->status.job_level >= pc->maxjoblv(sd)) {
clif->message(fd, msg_txt(23)); // Job level can't go any higher.
return false;
}
- if ((unsigned int)level > iPc->maxjoblv(sd) || (unsigned int)level > iPc->maxjoblv(sd) - sd->status.job_level) // fix positiv overflow
- level = iPc->maxjoblv(sd) - sd->status.job_level;
+ if ((unsigned int)level > pc->maxjoblv(sd) || (unsigned int)level > pc->maxjoblv(sd) - sd->status.job_level) // fix positiv overflow
+ level = pc->maxjoblv(sd) - sd->status.job_level;
sd->status.job_level += (unsigned int)level;
sd->status.skill_point += level;
clif->misceffect(&sd->bl, 1);
@@ -1366,7 +1366,7 @@ ACMD(joblevelup)
level = sd->status.job_level-1;
sd->status.job_level -= (unsigned int)level;
if (sd->status.skill_point < level)
- iPc->resetskill(sd,0); //Reset skills since we need to substract more points.
+ pc->resetskill(sd,0); //Reset skills since we need to substract more points.
if (sd->status.skill_point < level)
sd->status.skill_point = 0;
else
@@ -1469,7 +1469,7 @@ static int atcommand_pvpoff_sub(struct block_list *bl,va_list ap)
TBL_PC* sd = (TBL_PC*)bl;
clif->pvpset(sd, 0, 0, 2);
if (sd->pvp_timer != INVALID_TIMER) {
- iTimer->delete_timer(sd->pvp_timer, iPc->calc_pvprank_timer);
+ iTimer->delete_timer(sd->pvp_timer, pc->calc_pvprank_timer);
sd->pvp_timer = INVALID_TIMER;
}
return 0;
@@ -1504,7 +1504,7 @@ static int atcommand_pvpon_sub(struct block_list *bl,va_list ap)
{
TBL_PC* sd = (TBL_PC*)bl;
if (sd->pvp_timer == INVALID_TIMER) {
- sd->pvp_timer = iTimer->add_timer(iTimer->gettick() + 200, iPc->calc_pvprank_timer, sd->bl.id, 0);
+ sd->pvp_timer = iTimer->add_timer(iTimer->gettick() + 200, pc->calc_pvprank_timer, sd->bl.id, 0);
sd->pvp_rank = 0;
sd->pvp_lastusers = 0;
sd->pvp_point = 5;
@@ -1600,9 +1600,9 @@ ACMD(model)
if (hair_style >= MIN_HAIR_STYLE && hair_style <= MAX_HAIR_STYLE &&
hair_color >= MIN_HAIR_COLOR && hair_color <= MAX_HAIR_COLOR &&
cloth_color >= MIN_CLOTH_COLOR && cloth_color <= MAX_CLOTH_COLOR) {
- iPc->changelook(sd, LOOK_HAIR, hair_style);
- iPc->changelook(sd, LOOK_HAIR_COLOR, hair_color);
- iPc->changelook(sd, LOOK_CLOTHES_COLOR, cloth_color);
+ pc->changelook(sd, LOOK_HAIR, hair_style);
+ pc->changelook(sd, LOOK_HAIR_COLOR, hair_color);
+ pc->changelook(sd, LOOK_CLOTHES_COLOR, cloth_color);
clif->message(fd, msg_txt(36)); // Appearence changed.
} else {
clif->message(fd, msg_txt(37)); // An invalid number was specified.
@@ -1629,7 +1629,7 @@ ACMD(dye)
}
if (cloth_color >= MIN_CLOTH_COLOR && cloth_color <= MAX_CLOTH_COLOR) {
- iPc->changelook(sd, LOOK_CLOTHES_COLOR, cloth_color);
+ pc->changelook(sd, LOOK_CLOTHES_COLOR, cloth_color);
clif->message(fd, msg_txt(36)); // Appearence changed.
} else {
clif->message(fd, msg_txt(37)); // An invalid number was specified.
@@ -1656,7 +1656,7 @@ ACMD(hair_style)
}
if (hair_style >= MIN_HAIR_STYLE && hair_style <= MAX_HAIR_STYLE) {
- iPc->changelook(sd, LOOK_HAIR, hair_style);
+ pc->changelook(sd, LOOK_HAIR, hair_style);
clif->message(fd, msg_txt(36)); // Appearence changed.
} else {
clif->message(fd, msg_txt(37)); // An invalid number was specified.
@@ -1683,7 +1683,7 @@ ACMD(hair_color)
}
if (hair_color >= MIN_HAIR_COLOR && hair_color <= MAX_HAIR_COLOR) {
- iPc->changelook(sd, LOOK_HAIR_COLOR, hair_color);
+ pc->changelook(sd, LOOK_HAIR_COLOR, hair_color);
clif->message(fd, msg_txt(36)); // Appearence changed.
} else {
clif->message(fd, msg_txt(37)); // An invalid number was specified.
@@ -1873,7 +1873,7 @@ ACMD(go)
clif->message(fd, msg_txt(248));
return false;
}
- if (iPc->setpos(sd, mapindex_name2id(data[town].map), data[town].x, data[town].y, CLR_TELEPORT) == 0) {
+ if (pc->setpos(sd, mapindex_name2id(data[town].map), data[town].x, data[town].y, CLR_TELEPORT) == 0) {
clif->message(fd, msg_txt(0)); // Warped.
} else {
clif->message(fd, msg_txt(1)); // Map not found.
@@ -2085,11 +2085,11 @@ ACMD(refine)
if (sd->status.inventory[i].refine != final_refine) {
sd->status.inventory[i].refine = final_refine;
current_position = sd->status.inventory[i].equip;
- iPc->unequipitem(sd, i, 3);
+ pc->unequipitem(sd, i, 3);
clif->refine(fd, 0, i, sd->status.inventory[i].refine);
clif->delitem(sd, i, 1, 3);
clif->additem(sd, i, 1, 0);
- iPc->equipitem(sd, i, current_position);
+ pc->equipitem(sd, i, current_position);
clif->misceffect(&sd->bl, 3);
count++;
}
@@ -2155,7 +2155,7 @@ ACMD(produce)
clif->produce_effect(sd, 0, item_id);
clif->misceffect(&sd->bl, 3);
- if ((flag = iPc->additem(sd, &tmp_item, 1, LOG_TYPE_COMMAND)))
+ if ((flag = pc->additem(sd, &tmp_item, 1, LOG_TYPE_COMMAND)))
clif->additem(sd, 0, 0, flag);
} else {
sprintf(atcmd_output, msg_txt(169), item_id, item_data->name); // The item (%d: '%s') is not equipable.
@@ -2198,7 +2198,7 @@ ACMD(memo)
return false;
}
- iPc->memo(sd, position);
+ pc->memo(sd, position);
return true;
}
@@ -2361,12 +2361,12 @@ ACMD(zeny)
}
if(zeny > 0){
- if((ret=iPc->getzeny(sd,zeny,LOG_TYPE_COMMAND,NULL)) == 1)
+ if((ret=pc->getzeny(sd,zeny,LOG_TYPE_COMMAND,NULL)) == 1)
clif->message(fd, msg_txt(149)); // Unable to increase the number/value.
}
else {
if( sd->status.zeny < -zeny ) zeny = -sd->status.zeny;
- if((ret=iPc->payzeny(sd,-zeny,LOG_TYPE_COMMAND,NULL)) == 1)
+ if((ret=pc->payzeny(sd,-zeny,LOG_TYPE_COMMAND,NULL)) == 1)
clif->message(fd, msg_txt(41)); // Unable to decrease the number/value.
}
if(!ret) clif->message(fd, msg_txt(176)); //ret=0 mean cmd success
@@ -2707,7 +2707,7 @@ ACMD(recall) {
return false;
}
- if ( iPc->get_group_level(sd) < iPc->get_group_level(pl_sd) )
+ if ( pc->get_group_level(sd) < pc->get_group_level(pl_sd) )
{
clif->message(fd, msg_txt(81)); // Your GM level doesn't authorize you to preform this action on the specified player.
return false;
@@ -2724,7 +2724,7 @@ ACMD(recall) {
if (pl_sd->bl.m == sd->bl.m && pl_sd->bl.x == sd->bl.x && pl_sd->bl.y == sd->bl.y) {
return false;
}
- iPc->setpos(pl_sd, sd->mapindex, sd->bl.x, sd->bl.y, CLR_RESPAWN);
+ pc->setpos(pl_sd, sd->mapindex, sd->bl.x, sd->bl.y, CLR_RESPAWN);
sprintf(atcmd_output, msg_txt(46), pl_sd->status.name); // %s recalled!
clif->message(fd, atcmd_output);
@@ -2838,7 +2838,7 @@ ACMD(char_ban)
tmtime->tm_min = tmtime->tm_min + minute;
tmtime->tm_sec = tmtime->tm_sec + second;
timestamp = mktime(tmtime);
- if( timestamp <= time(NULL) && !iPc->can_use_command(sd, "@unban") ) {
+ if( timestamp <= time(NULL) && !pc->can_use_command(sd, "@unban") ) {
clif->message(fd,msg_txt(1023)); // You are not allowed to reduce the length of a ban.
return false;
}
@@ -2899,7 +2899,7 @@ ACMD(night)
nullpo_retr(-1, sd);
if (iMap->night_flag != 1) {
- iPc->map_night_timer(iPc->night_timer_tid, 0, 0, 1);
+ pc->map_night_timer(pc->night_timer_tid, 0, 0, 1);
} else {
clif->message(fd, msg_txt(89)); // Night mode is already enabled.
return false;
@@ -2916,7 +2916,7 @@ ACMD(day)
nullpo_retr(-1, sd);
if (iMap->night_flag != 0) {
- iPc->map_day_timer(iPc->day_timer_tid, 0, 0, 1);
+ pc->map_day_timer(pc->day_timer_tid, 0, 0, 1);
} else {
clif->message(fd, msg_txt(90)); // Day mode is already enabled.
return false;
@@ -2938,7 +2938,7 @@ ACMD(doom)
iter = mapit_getallusers();
for( pl_sd = (TBL_PC*)mapit->first(iter); mapit->exists(iter); pl_sd = (TBL_PC*)mapit->next(iter) )
{
- if (pl_sd->fd != fd && iPc->get_group_level(sd) >= iPc->get_group_level(pl_sd))
+ if (pl_sd->fd != fd && pc->get_group_level(sd) >= pc->get_group_level(pl_sd))
{
status_kill(&pl_sd->bl);
clif->specialeffect(&pl_sd->bl,450,AREA);
@@ -2965,7 +2965,7 @@ ACMD(doommap)
iter = mapit_getallusers();
for( pl_sd = (TBL_PC*)mapit->first(iter); mapit->exists(iter); pl_sd = (TBL_PC*)mapit->next(iter) )
{
- if (pl_sd->fd != fd && sd->bl.m == pl_sd->bl.m && iPc->get_group_level(sd) >= iPc->get_group_level(pl_sd))
+ if (pl_sd->fd != fd && sd->bl.m == pl_sd->bl.m && pc->get_group_level(sd) >= pc->get_group_level(pl_sd))
{
status_kill(&pl_sd->bl);
clif->specialeffect(&pl_sd->bl,450,AREA);
@@ -3053,7 +3053,7 @@ ACMD(kick)
return false;
}
- if ( iPc->get_group_level(sd) < iPc->get_group_level(pl_sd) )
+ if ( pc->get_group_level(sd) < pc->get_group_level(pl_sd) )
{
clif->message(fd, msg_txt(81)); // Your GM level don't authorise you to do this action on this player.
return false;
@@ -3076,7 +3076,7 @@ ACMD(kickall)
iter = mapit_getallusers();
for( pl_sd = (TBL_PC*)mapit->first(iter); mapit->exists(iter); pl_sd = (TBL_PC*)mapit->next(iter) )
{
- if (iPc->get_group_level(sd) >= iPc->get_group_level(pl_sd)) { // you can kick only lower or same gm level
+ if (pc->get_group_level(sd) >= pc->get_group_level(pl_sd)) { // you can kick only lower or same gm level
if (sd->status.account_id != pl_sd->status.account_id)
clif->GM_kick(NULL, pl_sd);
}
@@ -3094,7 +3094,7 @@ ACMD(kickall)
ACMD(allskill)
{
nullpo_retr(-1, sd);
- iPc->allskillup(sd); // all skills
+ pc->allskillup(sd); // all skills
sd->status.skill_point = 0; // 0 skill points
clif->updatestatus(sd, SP_SKILLPOINT); // update
clif->message(fd, msg_txt(76)); // All skills have been added to your skill tree.
@@ -3134,12 +3134,12 @@ ACMD(questskill)
clif->message(fd, msg_txt(197)); // This skill number doesn't exist or isn't a quest skill.
return false;
}
- if (iPc->checkskill2(sd, index) > 0) {
+ if (pc->checkskill2(sd, index) > 0) {
clif->message(fd, msg_txt(196)); // You already have this quest skill.
return false;
}
- iPc->skill(sd, skill_id, 1, 0);
+ pc->skill(sd, skill_id, 1, 0);
clif->message(fd, msg_txt(70)); // You have learned the skill.
return true;
@@ -3177,7 +3177,7 @@ ACMD(lostskill)
clif->message(fd, msg_txt(197)); // This skill number doesn't exist or isn't a quest skill.
return false;
}
- if (iPc->checkskill2(sd, index) == 0) {
+ if (pc->checkskill2(sd, index) == 0) {
clif->message(fd, msg_txt(201)); // You don't have this quest skill.
return false;
}
@@ -3210,7 +3210,7 @@ ACMD(spiritball)
}
if( sd->spiritball > 0 )
- iPc->delspiritball(sd, sd->spiritball, 1);
+ pc->delspiritball(sd, sd->spiritball, 1);
sd->spiritball = number;
clif->spiritball(&sd->bl);
// no message, player can look the difference
@@ -3223,17 +3223,17 @@ ACMD(spiritball)
*------------------------------------------*/
ACMD(party)
{
- char party[NAME_LENGTH];
+ char party_name[NAME_LENGTH];
nullpo_retr(-1, sd);
- memset(party, '\0', sizeof(party));
+ memset(party_name, '\0', sizeof(party_name));
- if (!message || !*message || sscanf(message, "%23[^\n]", party) < 1) {
+ if (!message || !*message || sscanf(message, "%23[^\n]", party_name) < 1) {
clif->message(fd, msg_txt(1029)); // Please enter a party name (usage: @party <party_name>).
return false;
}
- iParty->create(sd, party, 0, 0);
+ party->create(sd, party_name, 0, 0);
return true;
}
@@ -3433,7 +3433,7 @@ ACMD(recallall)
iter = mapit_getallusers();
for( pl_sd = (TBL_PC*)mapit->first(iter); mapit->exists(iter); pl_sd = (TBL_PC*)mapit->next(iter) )
{
- if (sd->status.account_id != pl_sd->status.account_id && iPc->get_group_level(sd) >= iPc->get_group_level(pl_sd))
+ if (sd->status.account_id != pl_sd->status.account_id && pc->get_group_level(sd) >= pc->get_group_level(pl_sd))
{
if (pl_sd->bl.m == sd->bl.m && pl_sd->bl.x == sd->bl.x && pl_sd->bl.y == sd->bl.y)
continue; // Don't waste time warping the character to the same place.
@@ -3441,10 +3441,10 @@ ACMD(recallall)
count++;
else {
if (pc_isdead(pl_sd)) { //Wake them up
- iPc->setstand(pl_sd);
- iPc->setrestartvalue(pl_sd,1);
+ pc->setstand(pl_sd);
+ pc->setrestartvalue(pl_sd,1);
}
- iPc->setpos(pl_sd, sd->mapindex, sd->bl.x, sd->bl.y, CLR_RESPAWN);
+ pc->setpos(pl_sd, sd->mapindex, sd->bl.x, sd->bl.y, CLR_RESPAWN);
}
}
}
@@ -3498,12 +3498,12 @@ ACMD(guildrecall)
{
if (sd->status.account_id != pl_sd->status.account_id && pl_sd->status.guild_id == g->guild_id)
{
- if (iPc->get_group_level(pl_sd) > iPc->get_group_level(sd) || (pl_sd->bl.m == sd->bl.m && pl_sd->bl.x == sd->bl.x && pl_sd->bl.y == sd->bl.y))
+ if (pc->get_group_level(pl_sd) > pc->get_group_level(sd) || (pl_sd->bl.m == sd->bl.m && pl_sd->bl.x == sd->bl.x && pl_sd->bl.y == sd->bl.y))
continue; // Skip GMs greater than you... or chars already on the cell
if (pl_sd->bl.m >= 0 && map[pl_sd->bl.m].flag.nowarp && !pc_has_permission(sd, PC_PERM_WARP_ANYWHERE))
count++;
else
- iPc->setpos(pl_sd, sd->mapindex, sd->bl.x, sd->bl.y, CLR_RESPAWN);
+ pc->setpos(pl_sd, sd->mapindex, sd->bl.x, sd->bl.y, CLR_RESPAWN);
}
}
mapit->free(iter);
@@ -3543,8 +3543,8 @@ ACMD(partyrecall)
return false;
}
- if ((p = iParty->searchname(party_name)) == NULL && // name first to avoid error when name begin with a number
- (p = iParty->search(atoi(message))) == NULL)
+ if ((p = party->searchname(party_name)) == NULL && // name first to avoid error when name begin with a number
+ (p = party->search(atoi(message))) == NULL)
{
clif->message(fd, msg_txt(96)); // Incorrect name or ID, or no one from the party is online.
return false;
@@ -3557,12 +3557,12 @@ ACMD(partyrecall)
{
if (sd->status.account_id != pl_sd->status.account_id && pl_sd->status.party_id == p->party.party_id)
{
- if (iPc->get_group_level(pl_sd) > iPc->get_group_level(sd) || (pl_sd->bl.m == sd->bl.m && pl_sd->bl.x == sd->bl.x && pl_sd->bl.y == sd->bl.y))
+ if (pc->get_group_level(pl_sd) > pc->get_group_level(sd) || (pl_sd->bl.m == sd->bl.m && pl_sd->bl.x == sd->bl.x && pl_sd->bl.y == sd->bl.y))
continue; // Skip GMs greater than you... or chars already on the cell
if (pl_sd->bl.m >= 0 && map[pl_sd->bl.m].flag.nowarp && !pc_has_permission(sd, PC_PERM_WARP_ANYWHERE))
count++;
else
- iPc->setpos(pl_sd, sd->mapindex, sd->bl.x, sd->bl.y, CLR_RESPAWN);
+ pc->setpos(pl_sd, sd->mapindex, sd->bl.x, sd->bl.y, CLR_RESPAWN);
}
}
mapit->free(iter);
@@ -3708,7 +3708,7 @@ ACMD(reloadstatusdb)
*------------------------------------------*/
ACMD(reloadpcdb)
{
- iPc->readdb();
+ pc->readdb();
clif->message(fd, msg_txt(257));
return true;
}
@@ -4001,47 +4001,47 @@ ACMD(mount_peco)
return false;
}
- if( (sd->class_&MAPID_THIRDMASK) == MAPID_RUNE_KNIGHT && iPc->checkskill(sd,RK_DRAGONTRAINING) > 0 ) {
+ if( (sd->class_&MAPID_THIRDMASK) == MAPID_RUNE_KNIGHT && pc->checkskill(sd,RK_DRAGONTRAINING) > 0 ) {
if( !(sd->sc.option&OPTION_DRAGON1) ) {
clif->message(sd->fd,msg_txt(1119)); // You have mounted your Dragon.
- iPc->setoption(sd, sd->sc.option|OPTION_DRAGON1);
+ pc->setoption(sd, sd->sc.option|OPTION_DRAGON1);
} else {
clif->message(sd->fd,msg_txt(1120)); // You have released your Dragon.
- iPc->setoption(sd, sd->sc.option&~OPTION_DRAGON1);
+ pc->setoption(sd, sd->sc.option&~OPTION_DRAGON1);
}
return true;
}
- if( (sd->class_&MAPID_THIRDMASK) == MAPID_RANGER && iPc->checkskill(sd,RA_WUGRIDER) > 0 ) {
+ if( (sd->class_&MAPID_THIRDMASK) == MAPID_RANGER && pc->checkskill(sd,RA_WUGRIDER) > 0 ) {
if( !pc_isridingwug(sd) ) {
clif->message(sd->fd,msg_txt(1121)); // You have mounted your Warg.
- iPc->setoption(sd, sd->sc.option|OPTION_WUGRIDER);
+ pc->setoption(sd, sd->sc.option|OPTION_WUGRIDER);
} else {
clif->message(sd->fd,msg_txt(1122)); // You have released your Warg.
- iPc->setoption(sd, sd->sc.option&~OPTION_WUGRIDER);
+ pc->setoption(sd, sd->sc.option&~OPTION_WUGRIDER);
}
return true;
}
if( (sd->class_&MAPID_THIRDMASK) == MAPID_MECHANIC ) {
if( !pc_ismadogear(sd) ) {
clif->message(sd->fd,msg_txt(1123)); // You have mounted your Mado Gear.
- iPc->setoption(sd, sd->sc.option|OPTION_MADOGEAR);
+ pc->setoption(sd, sd->sc.option|OPTION_MADOGEAR);
} else {
clif->message(sd->fd,msg_txt(1124)); // You have released your Mado Gear.
- iPc->setoption(sd, sd->sc.option&~OPTION_MADOGEAR);
+ pc->setoption(sd, sd->sc.option&~OPTION_MADOGEAR);
}
return true;
}
if (!pc_isriding(sd)) { // if actually no peco
- if (!iPc->checkskill(sd, KN_RIDING)) {
+ if (!pc->checkskill(sd, KN_RIDING)) {
clif->message(fd, msg_txt(213)); // You can not mount a Peco Peco with your current job.
return false;
}
- iPc->setoption(sd, sd->sc.option | OPTION_RIDING);
+ pc->setoption(sd, sd->sc.option | OPTION_RIDING);
clif->message(fd, msg_txt(102)); // You have mounted a Peco Peco.
} else {//Dismount
- iPc->setoption(sd, sd->sc.option & ~OPTION_RIDING);
+ pc->setoption(sd, sd->sc.option & ~OPTION_RIDING);
clif->message(fd, msg_txt(214)); // You have released your Peco Peco.
}
@@ -4112,8 +4112,8 @@ ACMD(partyspy)
return false;
}
- if ((p = iParty->searchname(party_name)) != NULL || // name first to avoid error when name begin with a number
- (p = iParty->search(atoi(message))) != NULL) {
+ if ((p = party->searchname(party_name)) != NULL || // name first to avoid error when name begin with a number
+ (p = party->search(atoi(message))) != NULL) {
if (sd->partyspy == p->party.party_id) {
sd->partyspy = 0;
sprintf(atcmd_output, msg_txt(105), p->party.name); // No longer spying on the %s party.
@@ -4176,7 +4176,7 @@ ACMD(nuke)
}
if ((pl_sd = iMap->nick2sd(atcmd_player_name)) != NULL) {
- if (iPc->get_group_level(sd) >= iPc->get_group_level(pl_sd)) { // you can kill only lower or same GM level
+ if (pc->get_group_level(sd) >= pc->get_group_level(pl_sd)) { // you can kill only lower or same GM level
skill->castend_nodamage_id(&pl_sd->bl, &pl_sd->bl, NPC_SELFDESTRUCTION, 99, iTimer->gettick(), 0);
clif->message(fd, msg_txt(109)); // Player has been nuked!
} else {
@@ -4209,7 +4209,7 @@ ACMD(tonpc)
}
if ((nd = npc_name2id(npcname)) != NULL) {
- if (iPc->setpos(sd, map_id2index(nd->bl.m), nd->bl.x, nd->bl.y, CLR_TELEPORT) == 0)
+ if (pc->setpos(sd, map_id2index(nd->bl.m), nd->bl.x, nd->bl.y, CLR_TELEPORT) == 0)
clif->message(fd, msg_txt(0)); // Warped.
else
return false;
@@ -4390,7 +4390,7 @@ ACMD(servertime)
clif->message(fd, msg_txt(232)); // Game time: The game is in permanent night.
} else if (battle_config.night_duration == 0)
if (iMap->night_flag == 1) { // we start with night
- timer_data = iTimer->get_timer(iPc->day_timer_tid);
+ timer_data = iTimer->get_timer(pc->day_timer_tid);
sprintf(temp, msg_txt(233), txt_time(DIFF_TICK(timer_data->tick,iTimer->gettick())/1000)); // Game time: The game is actualy in night for %s.
clif->message(fd, temp);
clif->message(fd, msg_txt(234)); // Game time: After, the game will be in permanent daylight.
@@ -4398,7 +4398,7 @@ ACMD(servertime)
clif->message(fd, msg_txt(231)); // Game time: The game is in permanent daylight.
else if (battle_config.day_duration == 0)
if (iMap->night_flag == 0) { // we start with day
- timer_data = iTimer->get_timer(iPc->night_timer_tid);
+ timer_data = iTimer->get_timer(pc->night_timer_tid);
sprintf(temp, msg_txt(235), txt_time(DIFF_TICK(timer_data->tick,iTimer->gettick())/1000)); // Game time: The game is actualy in daylight for %s.
clif->message(fd, temp);
clif->message(fd, msg_txt(236)); // Game time: After, the game will be in permanent night.
@@ -4406,8 +4406,8 @@ ACMD(servertime)
clif->message(fd, msg_txt(232)); // Game time: The game is in permanent night.
else {
if (iMap->night_flag == 0) {
- timer_data = iTimer->get_timer(iPc->night_timer_tid);
- timer_data2 = iTimer->get_timer(iPc->day_timer_tid);
+ timer_data = iTimer->get_timer(pc->night_timer_tid);
+ timer_data2 = iTimer->get_timer(pc->day_timer_tid);
sprintf(temp, msg_txt(235), txt_time(DIFF_TICK(timer_data->tick,iTimer->gettick())/1000)); // Game time: The game is actualy in daylight for %s.
clif->message(fd, temp);
if (DIFF_TICK(timer_data->tick, timer_data2->tick) > 0)
@@ -4418,8 +4418,8 @@ ACMD(servertime)
sprintf(temp, msg_txt(238), txt_time(timer_data->interval / 1000)); // Game time: A day cycle has a normal duration of %s.
clif->message(fd, temp);
} else {
- timer_data = iTimer->get_timer(iPc->day_timer_tid);
- timer_data2 = iTimer->get_timer(iPc->night_timer_tid);
+ timer_data = iTimer->get_timer(pc->day_timer_tid);
+ timer_data2 = iTimer->get_timer(pc->night_timer_tid);
sprintf(temp, msg_txt(233), txt_time(DIFF_TICK(timer_data->tick,iTimer->gettick()) / 1000)); // Game time: The game is actualy in night for %s.
clif->message(fd, temp);
if (DIFF_TICK(timer_data->tick,timer_data2->tick) > 0)
@@ -4486,7 +4486,7 @@ ACMD(jail)
return false;
}
- if (iPc->get_group_level(sd) < iPc->get_group_level(pl_sd))
+ if (pc->get_group_level(sd) < pc->get_group_level(pl_sd))
{ // you can jail only lower or same GM
clif->message(fd, msg_txt(81)); // Your GM level don't authorise you to do this action on this player.
return false;
@@ -4538,7 +4538,7 @@ ACMD(unjail)
return false;
}
- if (iPc->get_group_level(sd) < iPc->get_group_level(pl_sd)) { // you can jail only lower or same GM
+ if (pc->get_group_level(sd) < pc->get_group_level(pl_sd)) { // you can jail only lower or same GM
clif->message(fd, msg_txt(81)); // Your GM level don't authorise you to do this action on this player.
return false;
@@ -4618,7 +4618,7 @@ ACMD(jailfor)
return false;
}
- if (iPc->get_group_level(pl_sd) > iPc->get_group_level(sd)) {
+ if (pc->get_group_level(pl_sd) > pc->get_group_level(sd)) {
clif->message(fd, msg_txt(81)); // Your GM level don't authorise you to do this action on this player.
return false;
}
@@ -4738,7 +4738,7 @@ ACMD(disguise)
return false;
}
- iPc->disguise(sd, id);
+ pc->disguise(sd, id);
clif->message(fd, msg_txt(122)); // Disguise applied.
return true;
@@ -4769,7 +4769,7 @@ ACMD(disguiseall)
iter = mapit_getallusers();
for( pl_sd = (TBL_PC*)mapit->first(iter); mapit->exists(iter); pl_sd = (TBL_PC*)mapit->next(iter) )
- iPc->disguise(pl_sd, mob_id);
+ pc->disguise(pl_sd, mob_id);
mapit->free(iter);
clif->message(fd, msg_txt(122)); // Disguise applied.
@@ -4817,7 +4817,7 @@ ACMD(disguiseguild)
for( i = 0; i < g->max_member; i++ )
if( (pl_sd = g->member[i].sd) && !pc_isriding(pl_sd) )
- iPc->disguise(pl_sd, id);
+ pc->disguise(pl_sd, id);
clif->message(fd, msg_txt(122)); // Disguise applied.
return true;
@@ -4831,7 +4831,7 @@ ACMD(undisguise)
{
nullpo_retr(-1, sd);
if (sd->disguise != -1) {
- iPc->disguise(sd, -1);
+ pc->disguise(sd, -1);
clif->message(fd, msg_txt(124)); // Undisguise applied.
} else {
clif->message(fd, msg_txt(125)); // You're not disguised.
@@ -4852,7 +4852,7 @@ ACMD(undisguiseall) {
iter = mapit_getallusers();
for( pl_sd = (TBL_PC*)mapit->first(iter); mapit->exists(iter); pl_sd = (TBL_PC*)mapit->next(iter) )
if( pl_sd->disguise != -1 )
- iPc->disguise(pl_sd, -1);
+ pc->disguise(pl_sd, -1);
mapit->free(iter);
clif->message(fd, msg_txt(124)); // Undisguise applied.
@@ -4885,7 +4885,7 @@ ACMD(undisguiseguild)
for(i = 0; i < g->max_member; i++)
if( (pl_sd = g->member[i].sd) && pl_sd->disguise != -1 )
- iPc->disguise(pl_sd, -1);
+ pc->disguise(pl_sd, -1);
clif->message(fd, msg_txt(124)); // Undisguise applied.
@@ -4902,11 +4902,11 @@ ACMD(exp)
nullpo_retr(-1, sd);
memset(output, '\0', sizeof(output));
- nextb = iPc->nextbaseexp(sd);
+ nextb = pc->nextbaseexp(sd);
if (nextb)
nextb = sd->status.base_exp*100.0/nextb;
- nextj = iPc->nextjobexp(sd);
+ nextj = pc->nextjobexp(sd);
if (nextj)
nextj = sd->status.job_exp*100.0/nextj;
@@ -5158,7 +5158,7 @@ ACMD(follow)
if (sd->followtarget == -1)
return false;
- iPc->stop_following (sd);
+ pc->stop_following (sd);
clif->message(fd, msg_txt(1159)); // Follow mode OFF.
return true;
}
@@ -5170,10 +5170,10 @@ ACMD(follow)
}
if (sd->followtarget == pl_sd->bl.id) {
- iPc->stop_following (sd);
+ pc->stop_following (sd);
clif->message(fd, msg_txt(1159)); // Follow mode OFF.
} else {
- iPc->follow(sd, pl_sd->bl.id);
+ pc->follow(sd, pl_sd->bl.id);
clif->message(fd, msg_txt(1160)); // Follow mode ON.
}
@@ -5192,8 +5192,8 @@ ACMD(dropall)
for (i = 0; i < MAX_INVENTORY; i++) {
if (sd->status.inventory[i].amount) {
if(sd->status.inventory[i].equip != 0)
- iPc->unequipitem(sd, i, 3);
- iPc->dropitem(sd, i, sd->status.inventory[i].amount);
+ pc->unequipitem(sd, i, 3);
+ pc->dropitem(sd, i, sd->status.inventory[i].amount);
}
}
return true;
@@ -5219,7 +5219,7 @@ ACMD(storeall)
for (i = 0; i < MAX_INVENTORY; i++) {
if (sd->status.inventory[i].amount) {
if(sd->status.inventory[i].equip != 0)
- iPc->unequipitem(sd, i, 3);
+ pc->unequipitem(sd, i, 3);
storage_storageadd(sd, i, sd->status.inventory[i].amount);
}
}
@@ -5306,7 +5306,7 @@ ACMD(clearcart)
for( i = 0; i < MAX_CART; i++ )
if(sd->status.cart[i].nameid > 0)
- iPc->cart_delitem(sd, i, sd->status.cart[i].amount, 1, LOG_TYPE_OTHER);
+ pc->cart_delitem(sd, i, sd->status.cart[i].amount, 1, LOG_TYPE_OTHER);
clif->clearcart(fd);
clif->updatestatus(sd,SP_CARTINFO);
@@ -5340,12 +5340,12 @@ ACMD(skillid) {
iter = db_iterator(skilldb_name2id);
for( data = iter->first(iter,&key); iter->exists(iter); data = iter->next(iter,&key) ) {
- idx = skill->get_index(iDB->data2i(data));
+ idx = skill->get_index(DB->data2i(data));
if (strnicmp(key.str, message, skillen) == 0 || strnicmp(skill_db[idx].desc, message, skillen) == 0) {
- sprintf(atcmd_output, msg_txt(1164), iDB->data2i(data), skill_db[idx].desc, key.str); // skill %d: %s (%s)
+ sprintf(atcmd_output, msg_txt(1164), DB->data2i(data), skill_db[idx].desc, key.str); // skill %d: %s (%s)
clif->message(fd, atcmd_output);
} else if ( found < MAX_SKILLID_PARTIAL_RESULTS && ( stristr(key.str,message) || stristr(skill_db[idx].desc,message) ) ) {
- snprintf(partials[found++], MAX_SKILLID_PARTIAL_RESULTS_LEN, msg_txt(1164), iDB->data2i(data), skill_db[idx].desc, key.str);
+ snprintf(partials[found++], MAX_SKILLID_PARTIAL_RESULTS_LEN, msg_txt(1164), DB->data2i(data), skill_db[idx].desc, key.str);
}
}
@@ -5387,7 +5387,7 @@ ACMD(useskill)
return false;
}
- if ( iPc->get_group_level(sd) < iPc->get_group_level(pl_sd) )
+ if ( pc->get_group_level(sd) < pc->get_group_level(pl_sd) )
{
clif->message(fd, msg_txt(81)); // Your GM level don't authorise you to do this action on this player.
return false;
@@ -5457,10 +5457,10 @@ ACMD(skilltree)
return false;
}
- c = iPc->calc_skilltree_normalize_job(pl_sd);
- c = iPc->mapid2jobid(c, pl_sd->status.sex);
+ c = pc->calc_skilltree_normalize_job(pl_sd);
+ c = pc->mapid2jobid(c, pl_sd->status.sex);
- sprintf(atcmd_output, msg_txt(1168), iPc->job_name(c), iPc->checkskill(pl_sd, NV_BASIC)); // Player is using %s skill tree (%d basic points).
+ sprintf(atcmd_output, msg_txt(1168), pc->job_name(c), pc->checkskill(pl_sd, NV_BASIC)); // Player is using %s skill tree (%d basic points).
clif->message(fd, atcmd_output);
ARR_FIND( 0, MAX_SKILL_TREE, j, skill_tree[c][j].id == 0 || skill_tree[c][j].id == skill_id );
@@ -5475,7 +5475,7 @@ ACMD(skilltree)
meets = 1;
for(j=0;j<MAX_PC_SKILL_REQUIRE;j++)
{
- if( ent->need[j].id && iPc->checkskill(sd,ent->need[j].id) < ent->need[j].lv)
+ if( ent->need[j].id && pc->checkskill(sd,ent->need[j].id) < ent->need[j].lv)
{
sprintf(atcmd_output, msg_txt(1170), ent->need[j].lv, skill_db[ent->need[j].id].desc); // Player requires level %d of skill %s.
clif->message(fd, atcmd_output);
@@ -5503,7 +5503,7 @@ void getring (struct map_session_data* sd)
item_tmp.card[2] = sd->status.partner_id;
item_tmp.card[3] = sd->status.partner_id >> 16;
- if((flag = iPc->additem(sd,&item_tmp,1,LOG_TYPE_COMMAND))) {
+ if((flag = pc->additem(sd,&item_tmp,1,LOG_TYPE_COMMAND))) {
clif->additem(sd,0,0,flag);
iMap->addflooritem(&item_tmp,1,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0);
}
@@ -5530,7 +5530,7 @@ ACMD(marry)
return false;
}
- if (iPc->marriage(sd, pl_sd) == 0) {
+ if (pc->marriage(sd, pl_sd) == 0) {
clif->message(fd, msg_txt(1173)); // They are married... wish them well.
clif->wedding_effect(&pl_sd->bl); //wedding effect and music [Lupus]
getring(sd); // Auto-give named rings (Aru)
@@ -5550,7 +5550,7 @@ ACMD(divorce)
{
nullpo_retr(-1, sd);
- if (iPc->divorce(sd) != 0) {
+ if (pc->divorce(sd) != 0) {
sprintf(atcmd_output, msg_txt(1175), sd->status.name); // '%s' is not married.
clif->message(fd, atcmd_output);
return false;
@@ -5670,7 +5670,7 @@ ACMD(changeleader)
return false;
}
- if (iParty->changeleader(sd, iMap->nick2sd((char *) message)))
+ if (party->changeleader(sd, iMap->nick2sd((char *) message)))
return true;
return false;
}
@@ -5686,7 +5686,7 @@ ACMD(partyoption)
char w1[16], w2[16];
nullpo_retr(-1, sd);
- if (sd->status.party_id == 0 || (p = iParty->search(sd->status.party_id)) == NULL)
+ if (sd->status.party_id == 0 || (p = party->search(sd->status.party_id)) == NULL)
{
clif->message(fd, msg_txt(282));
return false;
@@ -5712,7 +5712,7 @@ ACMD(partyoption)
//Change item share type.
if (option != p->party.item)
- iParty->changeoption(sd, p->party.exp, option);
+ party->changeoption(sd, p->party.exp, option);
else
clif->message(fd, msg_txt(286));
@@ -6148,7 +6148,7 @@ ACMD(npctalk)
unsigned long color=0;
if (sd->sc.count && //no "chatting" while muted.
- (sd->sc.data[SC_BERSERK] || sd->sc.data[SC__BLOODYLUST] ||
+ (sd->sc.data[SC_BERSERK] || sd->sc.data[SC_DEEPSLEEP] || sd->sc.data[SC__BLOODYLUST] ||
(sd->sc.data[SC_NOCHAT] && sd->sc.data[SC_NOCHAT]->val1&MANNER_NOCHAT)))
return false;
@@ -6199,7 +6199,7 @@ ACMD(pettalk)
}
if (sd->sc.count && //no "chatting" while muted.
- (sd->sc.data[SC_BERSERK] || sd->sc.data[SC__BLOODYLUST] ||
+ (sd->sc.data[SC_BERSERK] || sd->sc.data[SC_DEEPSLEEP] || sd->sc.data[SC__BLOODYLUST] ||
(sd->sc.data[SC_NOCHAT] && sd->sc.data[SC_NOCHAT]->val1&MANNER_NOCHAT)))
return false;
@@ -6294,8 +6294,8 @@ ACMD(users)
*------------------------------------------*/
ACMD(reset)
{
- iPc->resetstate(sd);
- iPc->resetskill(sd,1);
+ pc->resetstate(sd);
+ pc->resetskill(sd,1);
sprintf(atcmd_output, msg_txt(208), sd->status.name); // '%s' skill and stats points reseted!
clif->message(fd, atcmd_output);
return true;
@@ -6487,10 +6487,10 @@ ACMD(changesex)
{
int i;
nullpo_retr(-1, sd);
- iPc->resetskill(sd,4);
+ pc->resetskill(sd,4);
// to avoid any problem with equipment and invalid sex, equipment is unequiped.
for( i=0; i<EQI_MAX; i++ )
- if( sd->equip_index[i] >= 0 ) iPc->unequipitem(sd, sd->equip_index[i], 3);
+ if( sd->equip_index[i] >= 0 ) pc->unequipitem(sd, sd->equip_index[i], 3);
chrif_changesex(sd);
return true;
}
@@ -6515,7 +6515,7 @@ ACMD(mute)
return false;
}
- if ( iPc->get_group_level(sd) < iPc->get_group_level(pl_sd) )
+ if ( pc->get_group_level(sd) < pc->get_group_level(pl_sd) )
{
clif->message(fd, msg_txt(81)); // Your GM level don't authorise you to do this action on this player.
return false;
@@ -6867,18 +6867,24 @@ ACMD(hommutate) {
ACMD(makehomun) {
int homunid;
nullpo_retr(-1, sd);
-
- if ( sd->status.hom_id ) {
- clif->message(fd, msg_txt(450));
- return false;
- }
-
+
if (!message || !*message) {
clif->message(fd, msg_txt(1256)); // Please enter a homunculus ID (usage: @makehomun <homunculus id>).
return false;
}
homunid = atoi(message);
+
+ if( homunid == -1 && sd->status.hom_id && !homun_alive(sd->hd) ) {
+ homun->call(sd);
+ return true;
+ }
+
+ if ( sd->status.hom_id ) {
+ clif->message(fd, msg_txt(450));
+ return false;
+ }
+
if( homunid < HM_CLASS_BASE || homunid > HM_CLASS_BASE + MAX_HOMUNCULUS_CLASS - 1 )
{
clif->message(fd, msg_txt(1257)); // Invalid Homunculus ID.
@@ -6959,7 +6965,7 @@ ACMD(homtalk)
}
if (sd->sc.count && //no "chatting" while muted.
- (sd->sc.data[SC_BERSERK] || sd->sc.data[SC__BLOODYLUST] ||
+ (sd->sc.data[SC_BERSERK] || sd->sc.data[SC_DEEPSLEEP] || sd->sc.data[SC__BLOODYLUST] ||
(sd->sc.data[SC_NOCHAT] && sd->sc.data[SC_NOCHAT]->val1&MANNER_NOCHAT)))
return false;
@@ -7276,7 +7282,7 @@ static int atcommand_mutearea_sub(struct block_list *bl,va_list ap)
id = va_arg(ap, int);
time = va_arg(ap, int);
- if (id != bl->id && !iPc->get_group_level(pl_sd)) {
+ if (id != bl->id && !pc->get_group_level(pl_sd)) {
pl_sd->status.manner -= time;
if (pl_sd->status.manner < 0)
sc_start(&pl_sd->bl,SC_NOCHAT,100,0,0);
@@ -7342,7 +7348,7 @@ ACMD(me)
memset(atcmd_output, '\0', sizeof(atcmd_output));
if (sd->sc.count && //no "chatting" while muted.
- (sd->sc.data[SC_BERSERK] || sd->sc.data[SC__BLOODYLUST] ||
+ (sd->sc.data[SC_BERSERK] || sd->sc.data[SC_DEEPSLEEP] || sd->sc.data[SC__BLOODYLUST] ||
(sd->sc.data[SC_NOCHAT] && sd->sc.data[SC_NOCHAT]->val1&MANNER_NOCHAT)))
return false;
@@ -7371,7 +7377,7 @@ ACMD(size)
if(sd->state.size) {
sd->state.size = SZ_SMALL;
- iPc->setpos(sd, sd->mapindex, sd->bl.x, sd->bl.y, CLR_TELEPORT);
+ pc->setpos(sd, sd->mapindex, sd->bl.x, sd->bl.y, CLR_TELEPORT);
}
sd->state.size = size;
@@ -7398,7 +7404,7 @@ ACMD(sizeall)
if( pl_sd->state.size != size ) {
if( pl_sd->state.size ) {
pl_sd->state.size = SZ_SMALL;
- iPc->setpos(pl_sd, pl_sd->mapindex, pl_sd->bl.x, pl_sd->bl.y, CLR_TELEPORT);
+ pc->setpos(pl_sd, pl_sd->mapindex, pl_sd->bl.x, pl_sd->bl.y, CLR_TELEPORT);
}
pl_sd->state.size = size;
@@ -7440,7 +7446,7 @@ ACMD(sizeguild)
if( (pl_sd = g->member[i].sd) && pl_sd->state.size != size ) {
if( pl_sd->state.size ) {
pl_sd->state.size = SZ_SMALL;
- iPc->setpos(pl_sd, pl_sd->mapindex, pl_sd->bl.x, pl_sd->bl.y, CLR_TELEPORT);
+ pc->setpos(pl_sd, pl_sd->mapindex, pl_sd->bl.x, pl_sd->bl.y, CLR_TELEPORT);
}
pl_sd->state.size = size;
@@ -7820,13 +7826,13 @@ ACMD(cash)
if( !strcmpi(command+1,"cash") )
{
if( value > 0 ) {
- if( (ret=iPc->getcash(sd, value, 0)) >= 0){
+ if( (ret=pc->getcash(sd, value, 0)) >= 0){
sprintf(output, msg_txt(505), ret, sd->cashPoints);
clif->disp_onlyself(sd, output, strlen(output));
}
else clif->message(fd, msg_txt(149)); // Unable to decrease the number/value.
} else {
- if( (ret=iPc->paycash(sd, -value, 0)) >= 0){
+ if( (ret=pc->paycash(sd, -value, 0)) >= 0){
sprintf(output, msg_txt(410), ret, sd->cashPoints);
clif->disp_onlyself(sd, output, strlen(output));
}
@@ -7836,13 +7842,13 @@ ACMD(cash)
else
{ // @points
if( value > 0 ) {
- if( (ret=iPc->getcash(sd, 0, value)) >= 0){
+ if( (ret=pc->getcash(sd, 0, value)) >= 0){
sprintf(output, msg_txt(506), ret, sd->kafraPoints);
clif->disp_onlyself(sd, output, strlen(output));
}
else clif->message(fd, msg_txt(149)); // Unable to decrease the number/value.
} else {
- if( (ret=iPc->paycash(sd, -value, -value)) >= 0){
+ if( (ret=pc->paycash(sd, -value, -value)) >= 0){
sprintf(output, msg_txt(411), ret, sd->kafraPoints);
clif->disp_onlyself(sd, output, strlen(output));
}
@@ -7869,7 +7875,7 @@ ACMD(clone)
return true;
}
- if(iPc->get_group_level(pl_sd) > iPc->get_group_level(sd)) {
+ if(pc->get_group_level(pl_sd) > pc->get_group_level(sd)) {
clif->message(fd, msg_txt(126)); // Cannot clone a player of higher GM level than yourself.
return true;
}
@@ -7948,7 +7954,7 @@ ACMD(request)
*------------------------------------------*/
ACMD(feelreset)
{
- iPc->resetfeel(sd);
+ pc->resetfeel(sd);
clif->message(fd, msg_txt(1324)); // Reset 'Feeling' maps.
return true;
@@ -8020,7 +8026,7 @@ ACMD(resetstat)
{
nullpo_retr(-1, sd);
- iPc->resetstate(sd);
+ pc->resetstate(sd);
sprintf(atcmd_output, msg_txt(207), sd->status.name);
clif->message(fd, atcmd_output);
return true;
@@ -8030,7 +8036,7 @@ ACMD(resetskill)
{
nullpo_retr(-1,sd);
- iPc->resetskill(sd,1);
+ pc->resetskill(sd,1);
sprintf(atcmd_output, msg_txt(206), sd->status.name);
clif->message(fd, atcmd_output);
return true;
@@ -8252,7 +8258,7 @@ ACMD(stats)
output_table[14].value = sd->change_level_2nd;
output_table[15].value = sd->change_level_3rd;
- sprintf(job_jobname, "Job - %s %s", iPc->job_name(sd->status.class_), "(level %d)");
+ sprintf(job_jobname, "Job - %s %s", pc->job_name(sd->status.class_), "(level %d)");
sprintf(output, msg_txt(53), sd->status.name); // '%s' stats:
clif->message(fd, output);
@@ -8292,7 +8298,7 @@ ACMD(delitem)
total = amount;
// delete items
- while( amount && ( idx = iPc->search_inventory(sd, nameid) ) != -1 )
+ while( amount && ( idx = pc->search_inventory(sd, nameid) ) != -1 )
{
int delamount = ( amount < sd->status.inventory[idx].amount ) ? amount : sd->status.inventory[idx].amount;
@@ -8300,7 +8306,7 @@ ACMD(delitem)
{// delete pet
intif_delete_petdata(MakeDWord(sd->status.inventory[idx].card[1], sd->status.inventory[idx].card[2]));
}
- iPc->delitem(sd, idx, delamount, 0, 0, LOG_TYPE_COMMAND);
+ pc->delitem(sd, idx, delamount, 0, 0, LOG_TYPE_COMMAND);
amount-= delamount;
}
@@ -8466,7 +8472,7 @@ ACMD(accinfo) {
//remove const type
safestrncpy(query, message, NAME_LENGTH);
- intif_request_accinfo( sd->fd, sd->bl.id, iPc->get_group_level(sd), query );
+ intif_request_accinfo( sd->fd, sd->bl.id, pc->get_group_level(sd), query );
return true;
}
@@ -8519,7 +8525,7 @@ ACMD(set) {
switch( reg[0] ) {
case '@':
- data->u.str = iPc->readregstr(sd, add_str(reg));
+ data->u.str = pc->readregstr(sd, add_str(reg));
break;
case '$':
data->u.str = mapreg_readregstr(add_str(reg));
@@ -8548,7 +8554,7 @@ ACMD(set) {
data->type = C_INT;
switch( reg[0] ) {
case '@':
- data->u.num = iPc->readreg(sd, add_str(reg));
+ data->u.num = pc->readreg(sd, add_str(reg));
break;
case '$':
data->u.num = mapreg_readreg(add_str(reg));
@@ -8674,7 +8680,7 @@ sd->status.skill[idx].lv = x?1:0; \
sd->status.skill[idx].flag = x?1:0;
int val = atoi(message);
- bool need_skill = iPc->checkskill(sd, MC_PUSHCART) ? false : true;
+ bool need_skill = pc->checkskill(sd, MC_PUSHCART) ? false : true;
unsigned int index = skill->get_index(MC_PUSHCART);
if( !message || !*message || val < 0 || val > MAX_CARTS ) {
@@ -8692,7 +8698,7 @@ sd->status.skill[idx].flag = x?1:0;
MC_CART_MDFY(1,index);
}
- if( iPc->setcart(sd, val) ) {
+ if( pc->setcart(sd, val) ) {
if( need_skill ) {
MC_CART_MDFY(0,index);
}
@@ -9156,7 +9162,7 @@ ACMD(channel) {
iter = db_iterator(channel->banned);
for( data = iter->first(iter,&key); iter->exists(iter); data = iter->next(iter,&key) ) {
- struct hChSysBanEntry * entry = iDB->data2ptr(data);
+ struct hChSysBanEntry * entry = DB->data2ptr(data);
if( !isA )
sprintf(atcmd_output, msg_txt(1444), entry->name);// - %s %s
@@ -9808,7 +9814,7 @@ bool is_atcommand(const int fd, struct map_session_data* sd, const char* message
// 1 = player invoked
if ( type == 1) {
//Commands are disabled on maps flagged as 'nocommand'
- if ( map[sd->bl.m].nocommand && iPc->get_group_level(sd) < map[sd->bl.m].nocommand ) {
+ if ( map[sd->bl.m].nocommand && pc->get_group_level(sd) < map[sd->bl.m].nocommand ) {
clif->message(fd, msg_txt(143));
return false;
}
@@ -9843,7 +9849,7 @@ bool is_atcommand(const int fd, struct map_session_data* sd, const char* message
break;
}
- if( !iPc->get_group_level(sd) ) {
+ if( !pc->get_group_level(sd) ) {
if( x >= 1 || y >= 1 ) { /* we have command */
info = get_atcommandinfo_byname(atcommand_checkalias(command + 1));
if( !info || info->char_groups[sd->group_pos] == 0 ) /* if we can't use or doesn't exist: don't even display the command failed message */
@@ -9881,8 +9887,8 @@ bool is_atcommand(const int fd, struct map_session_data* sd, const char* message
// Check if the binding isn't NULL and there is a NPC event, level of usage met, et cetera
if( binding != NULL && binding->npc_event[0] &&
- ((*atcmd_msg == atcommand->at_symbol && iPc->get_group_level(sd) >= binding->group_lv) ||
- (*atcmd_msg == atcommand->char_symbol && iPc->get_group_level(sd) >= binding->group_lv_char)))
+ ((*atcmd_msg == atcommand->at_symbol && pc->get_group_level(sd) >= binding->group_lv) ||
+ (*atcmd_msg == atcommand->char_symbol && pc->get_group_level(sd) >= binding->group_lv_char)))
{
// Check if self or character invoking; if self == character invoked, then self invoke.
bool invokeFlag = ((*atcmd_msg == atcommand->at_symbol) ? 1 : 0);
@@ -9906,7 +9912,7 @@ bool is_atcommand(const int fd, struct map_session_data* sd, const char* message
//Grab the command information and check for the proper GM level required to use it or if the command exists
info = get_atcommandinfo_byname(atcommand_checkalias(command + 1));
if (info == NULL) {
- if( iPc->get_group_level(sd) ) { // TODO: remove or replace with proper permission
+ if( pc->get_group_level(sd) ) { // TODO: remove or replace with proper permission
sprintf(output, msg_txt(153), command); // "%s is Unknown Command."
clif->message(fd, output);
atcommand_get_suggestions(sd, command + 1, *message == atcommand->at_symbol);
@@ -10089,14 +10095,15 @@ void atcommand_db_load_groups(void) {
cmd->at_groups = aMalloc( pc_group_max * sizeof(char) );
cmd->char_groups = aMalloc( pc_group_max * sizeof(char) );
for(i = 0; i < pc_group_max; i++) {
+ int idx = pc_group_id2idx(atcommand->group_ids[i]);
if( pc_group_can_use_command(atcommand->group_ids[i], cmd->command, COMMAND_ATCOMMAND ) )
- cmd->at_groups[i] = 1;
+ cmd->at_groups[idx] = 1;
else
- cmd->at_groups[i] = 0;
+ cmd->at_groups[idx] = 0;
if( pc_group_can_use_command(atcommand->group_ids[i], cmd->command, COMMAND_CHARCOMMAND ) )
- cmd->char_groups[i] = 1;
+ cmd->char_groups[idx] = 1;
else
- cmd->char_groups[i] = 0;
+ cmd->char_groups[idx] = 0;
}
}
diff --git a/src/map/battle.c b/src/map/battle.c
index 9348c62cd..a2cc7692c 100644
--- a/src/map/battle.c
+++ b/src/map/battle.c
@@ -882,7 +882,7 @@ int battle_calc_damage(struct block_list *src,struct block_list *bl,struct Damag
if(sc->data[SC_DODGE] && ( !sc->opt1 || sc->opt1 == OPT1_BURNING ) &&
(flag&BF_LONG || sc->data[SC_SPURT])
&& rnd()%100 < 20) {
- if (sd && pc_issit(sd)) iPc->setstand(sd); //Stand it to dodge.
+ if (sd && pc_issit(sd)) pc->setstand(sd); //Stand it to dodge.
clif->skill_nodamage(bl,bl,TK_DODGE,1,1);
if (!sc->data[SC_COMBO])
sc_start4(bl, SC_COMBO, 100, TK_JUMPKICK, src->id, 1, 0, 2000);
@@ -1131,7 +1131,7 @@ int battle_calc_damage(struct block_list *src,struct block_list *bl,struct Damag
status_heal(src, damage*sce->val4/100, 0, 3);
if( sd && (sce = sc->data[SC_FORCEOFVANGUARD]) && flag&BF_WEAPON && rnd()%100 < sce->val2 )
- iPc->addspiritball(sd,skill->get_time(LG_FORCEOFVANGUARD,sce->val1),sce->val3);
+ pc->addspiritball(sd,skill->get_time(LG_FORCEOFVANGUARD,sce->val1),sce->val3);
if (sc->data[SC_STYLE_CHANGE] && rnd()%2) {
TBL_HOM *hd = BL_CAST(BL_HOM,bl);
if (hd) homun->addspiritball(hd, 10); //add a sphere
@@ -1256,7 +1256,7 @@ int battle_calc_damage(struct block_list *src,struct block_list *bl,struct Damag
else if( element == -3 ) //Use random element
element = rnd()%ELE_MAX;
if( element == ELE_FIRE || element == ELE_WATER )
- iPc->overheat(sd,element == ELE_FIRE ? 1 : -1);
+ pc->overheat(sd,element == ELE_FIRE ? 1 : -1);
}
}
@@ -1363,19 +1363,19 @@ int battle_addmastery(struct map_session_data *sd,struct block_list *target,int
nullpo_ret(sd);
- if((skill = iPc->checkskill(sd,AL_DEMONBANE)) > 0 &&
+ if((skill = pc->checkskill(sd,AL_DEMONBANE)) > 0 &&
target->type == BL_MOB && //This bonus doesnt work against players.
(battle->check_undead(status->race,status->def_ele) || status->race==RC_DEMON) )
damage += (skill*(int)(3+(sd->status.base_level+1)*0.05)); // submitted by orn
//damage += (skill * 3);
- if( (skill = iPc->checkskill(sd, RA_RANGERMAIN)) > 0 && (status->race == RC_BRUTE || status->race == RC_PLANT || status->race == RC_FISH) )
+ if( (skill = pc->checkskill(sd, RA_RANGERMAIN)) > 0 && (status->race == RC_BRUTE || status->race == RC_PLANT || status->race == RC_FISH) )
damage += (skill * 5);
- if( (skill = iPc->checkskill(sd,NC_RESEARCHFE)) > 0 && (status->def_ele == ELE_FIRE || status->def_ele == ELE_EARTH) )
+ if( (skill = pc->checkskill(sd,NC_RESEARCHFE)) > 0 && (status->def_ele == ELE_FIRE || status->def_ele == ELE_EARTH) )
damage += (skill * 10);
if( pc_ismadogear(sd) )
- damage += 20 + 20 * iPc->checkskill(sd, NC_MADOLICENCE);
+ damage += 20 + 20 * pc->checkskill(sd, NC_MADOLICENCE);
- if((skill = iPc->checkskill(sd,HT_BEASTBANE)) > 0 && (status->race==RC_BRUTE || status->race==RC_INSECT) ) {
+ if((skill = pc->checkskill(sd,HT_BEASTBANE)) > 0 && (status->race==RC_BRUTE || status->race==RC_INSECT) ) {
damage += (skill * 4);
if (sd->sc.data[SC_SPIRIT] && sd->sc.data[SC_SPIRIT]->val2 == SL_HUNTER)
damage += sd->status.str;
@@ -1389,26 +1389,26 @@ int battle_addmastery(struct map_session_data *sd,struct block_list *target,int
{
case W_1HSWORD:
#ifdef RENEWAL
- if((skill = iPc->checkskill(sd,AM_AXEMASTERY)) > 0)
+ if((skill = pc->checkskill(sd,AM_AXEMASTERY)) > 0)
damage += (skill * 3);
#endif
case W_DAGGER:
- if((skill = iPc->checkskill(sd,SM_SWORD)) > 0)
+ if((skill = pc->checkskill(sd,SM_SWORD)) > 0)
damage += (skill * 4);
- if((skill = iPc->checkskill(sd,GN_TRAINING_SWORD)) > 0)
+ if((skill = pc->checkskill(sd,GN_TRAINING_SWORD)) > 0)
damage += skill * 10;
break;
case W_2HSWORD:
#ifdef RENEWAL
- if((skill = iPc->checkskill(sd,AM_AXEMASTERY)) > 0)
+ if((skill = pc->checkskill(sd,AM_AXEMASTERY)) > 0)
damage += (skill * 3);
#endif
- if((skill = iPc->checkskill(sd,SM_TWOHAND)) > 0)
+ if((skill = pc->checkskill(sd,SM_TWOHAND)) > 0)
damage += (skill * 4);
break;
case W_1HSPEAR:
case W_2HSPEAR:
- if((skill = iPc->checkskill(sd,KN_SPEARMASTERY)) > 0) {
+ if((skill = pc->checkskill(sd,KN_SPEARMASTERY)) > 0) {
if(!pc_isriding(sd))
damage += (skill * 4);
else
@@ -1417,40 +1417,40 @@ int battle_addmastery(struct map_session_data *sd,struct block_list *target,int
break;
case W_1HAXE:
case W_2HAXE:
- if((skill = iPc->checkskill(sd,AM_AXEMASTERY)) > 0)
+ if((skill = pc->checkskill(sd,AM_AXEMASTERY)) > 0)
damage += (skill * 3);
- if((skill = iPc->checkskill(sd,NC_TRAININGAXE)) > 0)
+ if((skill = pc->checkskill(sd,NC_TRAININGAXE)) > 0)
damage += (skill * 5);
break;
case W_MACE:
case W_2HMACE:
- if((skill = iPc->checkskill(sd,PR_MACEMASTERY)) > 0)
+ if((skill = pc->checkskill(sd,PR_MACEMASTERY)) > 0)
damage += (skill * 3);
- if((skill = iPc->checkskill(sd,NC_TRAININGAXE)) > 0)
+ if((skill = pc->checkskill(sd,NC_TRAININGAXE)) > 0)
damage += (skill * 5);
break;
case W_FIST:
- if((skill = iPc->checkskill(sd,TK_RUN)) > 0)
+ if((skill = pc->checkskill(sd,TK_RUN)) > 0)
damage += (skill * 10);
// No break, fallthrough to Knuckles
case W_KNUCKLE:
- if((skill = iPc->checkskill(sd,MO_IRONHAND)) > 0)
+ if((skill = pc->checkskill(sd,MO_IRONHAND)) > 0)
damage += (skill * 3);
break;
case W_MUSICAL:
- if((skill = iPc->checkskill(sd,BA_MUSICALLESSON)) > 0)
+ if((skill = pc->checkskill(sd,BA_MUSICALLESSON)) > 0)
damage += (skill * 3);
break;
case W_WHIP:
- if((skill = iPc->checkskill(sd,DC_DANCINGLESSON)) > 0)
+ if((skill = pc->checkskill(sd,DC_DANCINGLESSON)) > 0)
damage += (skill * 3);
break;
case W_BOOK:
- if((skill = iPc->checkskill(sd,SA_ADVANCEDBOOK)) > 0)
+ if((skill = pc->checkskill(sd,SA_ADVANCEDBOOK)) > 0)
damage += (skill * 3);
break;
case W_KATAR:
- if((skill = iPc->checkskill(sd,AS_KATAR)) > 0)
+ if((skill = pc->checkskill(sd,AS_KATAR)) > 0)
damage += (skill * 3);
break;
}
@@ -1567,7 +1567,7 @@ void battle_consume_ammo(TBL_PC*sd, int skill_id, int lv) {
}
if(sd->equip_index[EQI_AMMO]>=0) //Qty check should have been done in skill_check_condition
- iPc->delitem(sd,sd->equip_index[EQI_AMMO],qty,0,1,LOG_TYPE_CONSUME);
+ pc->delitem(sd,sd->equip_index[EQI_AMMO],qty,0,1,LOG_TYPE_CONSUME);
sd->state.arrow_atk = 0;
}
@@ -1817,7 +1817,7 @@ struct Damage battle_calc_weapon_attack(struct block_list *src,struct block_list
}
if( sd && !skill_id ) { //Check for double attack.
- if( ( ( skill_lv = iPc->checkskill(sd,TF_DOUBLE) ) > 0 && sd->weapontype1 == W_DAGGER )
+ if( ( ( skill_lv = pc->checkskill(sd,TF_DOUBLE) ) > 0 && sd->weapontype1 == W_DAGGER )
|| ( sd->bonus.double_rate > 0 && sd->weapontype1 != W_FIST ) //Will fail bare-handed
|| ( sc && sc->data[SC_KAGEMUSYA] && sd->weapontype1 != W_FIST )) // Need confirmation
{ //Success chance is not added, the higher one is used [Skotlex]
@@ -1827,7 +1827,7 @@ struct Damage battle_calc_weapon_attack(struct block_list *src,struct block_list
wd.type = 0x08;
}
}
- else if( sd->weapontype1 == W_REVOLVER && (skill_lv = iPc->checkskill(sd,GS_CHAINACTION)) > 0 && rnd()%100 < 5*skill_lv )
+ else if( sd->weapontype1 == W_REVOLVER && (skill_lv = pc->checkskill(sd,GS_CHAINACTION)) > 0 && rnd()%100 < 5*skill_lv )
{
wd.div_ = skill->get_num(GS_CHAINACTION,skill_lv);
wd.type = 0x08;
@@ -1970,7 +1970,7 @@ struct Damage battle_calc_weapon_attack(struct block_list *src,struct block_list
hitrate += sd->bonus.arrow_hit;
#ifdef RENEWAL
if( sd ) //in Renewal hit bonus from Vultures Eye is not anymore shown in status window
- hitrate += iPc->checkskill(sd,AC_VULTURE);
+ hitrate += pc->checkskill(sd,AC_VULTURE);
#endif
if(skill_id)
switch(skill_id)
@@ -2003,14 +2003,14 @@ struct Damage battle_calc_weapon_attack(struct block_list *src,struct block_list
hitrate += hitrate * 5 * skill_lv / 100;
break;
case AS_SONICBLOW:
- if(sd && iPc->checkskill(sd,AS_SONICACCEL)>0)
+ if(sd && pc->checkskill(sd,AS_SONICACCEL)>0)
hitrate += hitrate * 50 / 100;
break;
case MC_CARTREVOLUTION:
case GN_CART_TORNADO:
case GN_CARTCANNON:
- if( sd && iPc->checkskill(sd, GN_REMODELING_CART) )
- hitrate += iPc->checkskill(sd, GN_REMODELING_CART) * 4;
+ if( sd && pc->checkskill(sd, GN_REMODELING_CART) )
+ hitrate += pc->checkskill(sd, GN_REMODELING_CART) * 4;
break;
case GC_VENOMPRESSURE:
hitrate += 10 + 4 * skill_lv;
@@ -2019,11 +2019,11 @@ struct Damage battle_calc_weapon_attack(struct block_list *src,struct block_list
if( sd ) {
// Weaponry Research hidden bonus
- if ((temp = iPc->checkskill(sd,BS_WEAPONRESEARCH)) > 0)
+ if ((temp = pc->checkskill(sd,BS_WEAPONRESEARCH)) > 0)
hitrate += hitrate * ( 2 * temp ) / 100;
if( (sd->status.weapon == W_1HSWORD || sd->status.weapon == W_DAGGER) &&
- (temp = iPc->checkskill(sd, GN_TRAINING_SWORD))>0 )
+ (temp = pc->checkskill(sd, GN_TRAINING_SWORD))>0 )
hitrate += 3 * temp;
}
@@ -2147,8 +2147,8 @@ struct Damage battle_calc_weapon_attack(struct block_list *src,struct block_list
if(flag.cri && sd->bonus.crit_atk_rate)
ATK_ADDRATE(sd->bonus.crit_atk_rate);
- if(sd->status.party_id && (temp=iPc->checkskill(sd,TK_POWER)) > 0){
- if( (i = party_foreachsamemap(iParty->sub_count, sd, 0)) > 1 ) // exclude the player himself [Inkfish]
+ if(sd->status.party_id && (temp=pc->checkskill(sd,TK_POWER)) > 0){
+ if( (i = party_foreachsamemap(party->sub_count, sd, 0)) > 1 ) // exclude the player himself [Inkfish]
ATK_ADDRATE(2*temp*i);
}
}
@@ -2393,7 +2393,7 @@ struct Damage battle_calc_weapon_attack(struct block_list *src,struct block_list
case AS_SPLASHER:
skillratio += 400+50*skill_lv;
if(sd)
- skillratio += 20 * iPc->checkskill(sd,AS_POISONREACT);
+ skillratio += 20 * pc->checkskill(sd,AS_POISONREACT);
break;
case ASC_BREAKER:
skillratio += 100*skill_lv-100;
@@ -2524,7 +2524,7 @@ struct Damage battle_calc_weapon_attack(struct block_list *src,struct block_list
if( index >= 0 && sd->inventory_data[index]
&& sd->inventory_data[index]->type == IT_WEAPON )
skillratio += max(10000 - sd->inventory_data[index]->weight, 0) / 10;
- skillratio += 50 * iPc->checkskill(sd,LK_SPIRALPIERCE);
+ skillratio += 50 * pc->checkskill(sd,LK_SPIRALPIERCE);
} // (1 + [(Casters Base Level - 100) / 200])
skillratio = skillratio * (100 + (status_get_lv(src)-100) / 2) / 100;
break;
@@ -2554,10 +2554,10 @@ struct Damage battle_calc_weapon_attack(struct block_list *src,struct block_list
}
break;
case RK_STORMBLAST:
- skillratio = 100 * (sd ? iPc->checkskill(sd,RK_RUNEMASTERY) : 1) + 100 * (sstatus->int_ / 4);
+ skillratio = 100 * (sd ? pc->checkskill(sd,RK_RUNEMASTERY) : 1) + 100 * (sstatus->int_ / 4);
break;
case RK_PHANTOMTHRUST:
- skillratio = 50 * skill_lv + 10 * ( sd ? iPc->checkskill(sd,KN_SPEARMASTERY) : 10);
+ skillratio = 50 * skill_lv + 10 * ( sd ? pc->checkskill(sd,KN_SPEARMASTERY) : 10);
//if( s_level > 100 ) skillratio += skillratio * s_level / 150; // Base level bonus. This is official, but is disabled until I can confirm something with was changed or not. [Rytech]
//if( s_level > 100 ) skillratio += skillratio * (s_level - 100) / 200; // Base level bonus.
break;
@@ -2682,7 +2682,7 @@ struct Damage battle_calc_weapon_attack(struct block_list *src,struct block_list
RE_LVL_DMOD(100);
break;
case LG_BANISHINGPOINT:
- skillratio += -100 + ((50 * skill_lv) + (30 * ((sd)?iPc->checkskill(sd,SM_BASH):1)));
+ skillratio += -100 + ((50 * skill_lv) + (30 * ((sd)?pc->checkskill(sd,SM_BASH):1)));
RE_LVL_DMOD(100);
break;
case LG_SHIELDPRESS:
@@ -2710,11 +2710,11 @@ struct Damage battle_calc_weapon_attack(struct block_list *src,struct block_list
skillratio += 2400; //2500%
break;
case LG_MOONSLASHER:
- skillratio += -100 + (120 * skill_lv + ((sd) ? iPc->checkskill(sd,LG_OVERBRAND) : 5) * 80);
+ skillratio += -100 + (120 * skill_lv + ((sd) ? pc->checkskill(sd,LG_OVERBRAND) : 5) * 80);
RE_LVL_DMOD(100);
break;
case LG_OVERBRAND:
- skillratio = 400 * skill_lv + (iPc->checkskill(sd,CR_SPEARQUICKEN) * 30);
+ skillratio = 400 * skill_lv + (pc->checkskill(sd,CR_SPEARQUICKEN) * 30);
RE_LVL_DMOD(100);
break;
case LG_OVERBRAND_BRANDISH:
@@ -2818,7 +2818,7 @@ struct Damage battle_calc_weapon_attack(struct block_list *src,struct block_list
break;
case WM_REVERBERATION_MELEE:
// ATK [{(Skill Level x 100) + 300} x Caster Base Level / 100]
- skillratio += 200 + 100 * iPc->checkskill(sd, WM_REVERBERATION);
+ skillratio += 200 + 100 * pc->checkskill(sd, WM_REVERBERATION);
RE_LVL_DMOD(100);
break;
case WM_SEVERE_RAINSTORM_MELEE:
@@ -2841,12 +2841,12 @@ struct Damage battle_calc_weapon_attack(struct block_list *src,struct block_list
// ATK [( Skill Level x 50 ) + ( Cart Weight / ( 150 - Caster Base STR ))] + ( Cart Remodeling Skill Level x 50 )] %
skillratio = 50 * skill_lv;
if( sd && sd->cart_weight)
- skillratio += sd->cart_weight/10 / max(150-sstatus->str,1) + iPc->checkskill(sd, GN_REMODELING_CART) * 50;
+ skillratio += sd->cart_weight/10 / max(150-sstatus->str,1) + pc->checkskill(sd, GN_REMODELING_CART) * 50;
break;
case GN_CARTCANNON:
// ATK [{( Cart Remodeling Skill Level x 50 ) x ( INT / 40 )} + ( Cart Cannon Skill Level x 60 )] %
skillratio = 60 * skill_lv;
- if( sd ) skillratio += iPc->checkskill(sd, GN_REMODELING_CART) * 50 * (sstatus->int_ / 40);
+ if( sd ) skillratio += pc->checkskill(sd, GN_REMODELING_CART) * 50 * (sstatus->int_ / 40);
break;
case GN_SPORE_EXPLOSION:
skillratio += 200 + 100 * skill_lv;
@@ -2874,7 +2874,7 @@ struct Damage battle_calc_weapon_attack(struct block_list *src,struct block_list
skillratio += 300; // Bombs
break;
case SO_VARETYR_SPEAR://ATK [{( Striking Level x 50 ) + ( Varetyr Spear Skill Level x 50 )} x Caster Base Level / 100 ] %
- skillratio = 50 * skill_lv + ( sd ? iPc->checkskill(sd, SO_STRIKING) * 50 : 0 );
+ skillratio = 50 * skill_lv + ( sd ? pc->checkskill(sd, SO_STRIKING) * 50 : 0 );
if( sc && sc->data[SC_BLAST_OPTION] )
skillratio += sd ? sd->status.job_level * 5 : 0;
break;
@@ -2917,7 +2917,7 @@ struct Damage battle_calc_weapon_attack(struct block_list *src,struct block_list
skillratio += 100 * (skill_lv-1);
break;
case KO_BAKURETSU:
- skillratio = 50 * skill_lv * (sd?iPc->checkskill(sd,NJ_TOBIDOUGU):10);
+ skillratio = 50 * skill_lv * (sd?pc->checkskill(sd,NJ_TOBIDOUGU):10);
break;
case MH_NEEDLE_OF_PARALYZE:
skillratio += 600 + 100 * skill_lv;
@@ -2951,7 +2951,7 @@ struct Damage battle_calc_weapon_attack(struct block_list *src,struct block_list
case TK_JUMPKICK:
//TK_RUN kick damage bonus.
if(sd && sd->weapontype1 == W_FIST && sd->weapontype2 == W_FIST)
- ATK_ADD(10*iPc->checkskill(sd, TK_RUN));
+ ATK_ADD(10*pc->checkskill(sd, TK_RUN));
break;
case GS_MAGICALBULLET:
if(sstatus->matk_max>sstatus->matk_min) {
@@ -2976,7 +2976,7 @@ struct Damage battle_calc_weapon_attack(struct block_list *src,struct block_list
#endif
case HT_FREEZINGTRAP:
if(sd)
- ATK_ADD( 40 * iPc->checkskill(sd, RA_RESEARCHTRAP) );
+ ATK_ADD( 40 * pc->checkskill(sd, RA_RESEARCHTRAP) );
break;
case RA_WUGDASH ://(Caster Current Weight x 10 / 8)
if( sd && sd->weight )
@@ -2984,7 +2984,7 @@ struct Damage battle_calc_weapon_attack(struct block_list *src,struct block_list
case RA_WUGSTRIKE:
case RA_WUGBITE:
if(sd)
- ATK_ADD(30*iPc->checkskill(sd, RA_TOOTHOFWUG));
+ ATK_ADD(30*pc->checkskill(sd, RA_TOOTHOFWUG));
break;
case SR_GATEOFHELL:
ATK_ADD (sstatus->max_hp - status_get_hp(src));
@@ -3020,7 +3020,7 @@ struct Damage battle_calc_weapon_attack(struct block_list *src,struct block_list
if( i < 5 ){
s_ele = i;
ATK_ADDRATE(100 * sd->talisman[i]);// +100% custom value.
- iPc->del_talisman(sd, sd->talisman[i], i);
+ pc->del_talisman(sd, sd->talisman[i], i);
}
}
break;
@@ -3072,7 +3072,7 @@ struct Damage battle_calc_weapon_attack(struct block_list *src,struct block_list
sc->data[SC_SPIRIT]->val2 == SL_ASSASIN)
ATK_ADDRATE(map_flag_gvg(src->m)?25:100); //+25% dmg on woe/+100% dmg on nonwoe
- if(sd && iPc->checkskill(sd,AS_SONICACCEL)>0)
+ if(sd && pc->checkskill(sd,AS_SONICACCEL)>0)
ATK_ADDRATE(10);
break;
case CR_SHIELDBOOMERANG:
@@ -3090,7 +3090,7 @@ struct Damage battle_calc_weapon_attack(struct block_list *src,struct block_list
ATK_RATE(i);
if( sd ) {
- if (skill_id && (i = iPc->skillatk_bonus(sd, skill_id)))
+ if (skill_id && (i = pc->skillatk_bonus(sd, skill_id)))
ATK_ADDRATE(i);
if( skill_id != PA_SACRIFICE && skill_id != MO_INVESTIGATE && skill_id != CR_GRANDCROSS && skill_id != NPC_GRANDDARKNESS && skill_id != PA_SHIELDCHAIN && !flag.cri )
@@ -3199,9 +3199,9 @@ struct Damage battle_calc_weapon_attack(struct block_list *src,struct block_list
vit_def = def2;
#endif
if((battle->check_undead(sstatus->race,sstatus->def_ele) || sstatus->race==RC_DEMON) && //This bonus already doesnt work vs players
- src->type == BL_MOB && (temp=iPc->checkskill(tsd,AL_DP)) > 0)
+ src->type == BL_MOB && (temp=pc->checkskill(tsd,AL_DP)) > 0)
vit_def += temp*(int)(3 +(tsd->status.base_level+1)*0.04); // submitted by orn
- if( src->type == BL_MOB && (temp=iPc->checkskill(tsd,RA_RANGERMAIN))>0 &&
+ if( src->type == BL_MOB && (temp=pc->checkskill(tsd,RA_RANGERMAIN))>0 &&
(sstatus->race == RC_BRUTE || sstatus->race == RC_FISH || sstatus->race == RC_PLANT) )
vit_def += temp*5;
#ifdef RENEWAL
@@ -3307,7 +3307,7 @@ struct Damage battle_calc_weapon_attack(struct block_list *src,struct block_list
skill_id != CR_GRANDCROSS)
{ //Add mastery damage
if(skill_id != ASC_BREAKER && sd->status.weapon == W_KATAR &&
- (temp=iPc->checkskill(sd,ASC_KATAR)) > 0)
+ (temp=pc->checkskill(sd,ASC_KATAR)) > 0)
{ //Adv Katar Mastery is does not applies to ASC_BREAKER,
// but other masteries DO apply >_>
ATK_ADDRATE(10+ 2*temp);
@@ -3320,14 +3320,14 @@ struct Damage battle_calc_weapon_attack(struct block_list *src,struct block_list
if (sc && sc->data[SC_MIRACLE]) i = 2; //Star anger
else
ARR_FIND(0, MAX_PC_FEELHATE, i, t_class == sd->hate_mob[i]);
- if (i < MAX_PC_FEELHATE && (temp=iPc->checkskill(sd,sg_info[i].anger_id))) {
+ if (i < MAX_PC_FEELHATE && (temp=pc->checkskill(sd,sg_info[i].anger_id))) {
skillratio = sd->status.base_level + sstatus->dex + sstatus->luk;
if (i == 2) skillratio += sstatus->str; //Star Anger
if (temp<4)
skillratio /= 12-3*temp;
ATK_ADDRATE(skillratio);
}
- if (skill_id == NJ_SYURIKEN && (temp = iPc->checkskill(sd,NJ_TOBIDOUGU)) > 0) {
+ if (skill_id == NJ_SYURIKEN && (temp = pc->checkskill(sd,NJ_TOBIDOUGU)) > 0) {
ATK_ADD(3*temp);
} else if (skill_id == NJ_KUNAI)
ATK_ADD(60);
@@ -3336,7 +3336,7 @@ struct Damage battle_calc_weapon_attack(struct block_list *src,struct block_list
else if(wd.div_ < 0) //Since the attack missed...
wd.div_ *= -1;
- if(sd && (temp=iPc->checkskill(sd,BS_WEAPONRESEARCH)) > 0)
+ if(sd && (temp=pc->checkskill(sd,BS_WEAPONRESEARCH)) > 0)
ATK_ADD(temp*2);
if(skill_id==TF_POISON)
@@ -3454,21 +3454,21 @@ struct Damage battle_calc_weapon_attack(struct block_list *src,struct block_list
flag.lh=0;
} else if(flag.rh && flag.lh) { //Dual-wield
if (wd.damage) {
- if( (temp = iPc->checkskill(sd,AS_RIGHT)) )
+ if( (temp = pc->checkskill(sd,AS_RIGHT)) )
ATK_RATER(50 + (temp * 10))
- else if( (temp = iPc->checkskill(sd,KO_RIGHT)) )
+ else if( (temp = pc->checkskill(sd,KO_RIGHT)) )
ATK_RATER(70 + (temp * 10))
if(wd.damage < 1) wd.damage = 1;
}
if (wd.damage2) {
- if( (temp = iPc->checkskill(sd,AS_LEFT)) )
+ if( (temp = pc->checkskill(sd,AS_LEFT)) )
ATK_RATEL(30 + (temp * 10))
- else if( (temp = iPc->checkskill(sd,KO_LEFT)) )
+ else if( (temp = pc->checkskill(sd,KO_LEFT)) )
ATK_RATEL(50 + (temp * 10))
if(wd.damage2 < 1) wd.damage2 = 1;
}
} else if(sd->status.weapon == W_KATAR && !skill_id) { //Katars (offhand damage only applies to normal attacks, tested on Aegis 10.2)
- temp = iPc->checkskill(sd,TF_DOUBLE);
+ temp = pc->checkskill(sd,TF_DOUBLE);
wd.damage2 = wd.damage * (1 + (temp * 2))/100;
if(wd.damage && !wd.damage2) wd.damage2 = 1;
@@ -3962,7 +3962,7 @@ struct Damage battle_calc_magic_attack(struct block_list *src,struct block_list
skillratio += 1900; //2000%
break;
case WM_METALICSOUND:
- skillratio += 120 * skill_lv + 60 * ( sd? iPc->checkskill(sd, WM_LESSON) : 10 ) - 100;
+ skillratio += 120 * skill_lv + 60 * ( sd? pc->checkskill(sd, WM_LESSON) : 10 ) - 100;
break;
/*case WM_SEVERE_RAINSTORM:
skillratio += 50 * skill_lv;
@@ -3973,7 +3973,7 @@ struct Damage battle_calc_magic_attack(struct block_list *src,struct block_list
*/
case WM_REVERBERATION_MAGIC:
// MATK [{(Skill Level x 100) + 100} x Casters Base Level / 100] %
- skillratio += 100 * (sd ? iPc->checkskill(sd, WM_REVERBERATION) : 1);
+ skillratio += 100 * (sd ? pc->checkskill(sd, WM_REVERBERATION) : 1);
RE_LVL_DMOD(100);
break;
case SO_FIREWALK:
@@ -3989,13 +3989,13 @@ struct Damage battle_calc_magic_attack(struct block_list *src,struct block_list
skillratio += sd ? sd->status.job_level / 2 : 0;
break;
case SO_EARTHGRAVE:
- skillratio = ( 200 * ( sd ? iPc->checkskill(sd, SA_SEISMICWEAPON) : 10 ) + sstatus->int_ * skill_lv );
+ skillratio = ( 200 * ( sd ? pc->checkskill(sd, SA_SEISMICWEAPON) : 10 ) + sstatus->int_ * skill_lv );
RE_LVL_DMOD(100);
if( sc && sc->data[SC_CURSED_SOIL_OPTION] )
skillratio += sc->data[SC_CURSED_SOIL_OPTION]->val2;
break;
case SO_DIAMONDDUST:
- skillratio = ( 200 * ( sd ? iPc->checkskill(sd, SA_FROSTWEAPON) : 10 ) + sstatus->int_ * skill_lv );
+ skillratio = ( 200 * ( sd ? pc->checkskill(sd, SA_FROSTWEAPON) : 10 ) + sstatus->int_ * skill_lv );
RE_LVL_DMOD(100);
if( sc && sc->data[SC_COOLER_OPTION] )
skillratio += sc->data[SC_COOLER_OPTION]->val3;
@@ -4020,7 +4020,7 @@ struct Damage battle_calc_magic_attack(struct block_list *src,struct block_list
}
break;
case SO_VARETYR_SPEAR: //MATK [{( Endow Tornado skill level x 50 ) + ( Caster INT x Varetyr Spear Skill level )} x Caster Base Level / 100 ] %
- skillratio = status_get_int(src) * skill_lv + ( sd ? iPc->checkskill(sd, SA_LIGHTNINGLOADER) * 50 : 0 );
+ skillratio = status_get_int(src) * skill_lv + ( sd ? pc->checkskill(sd, SA_LIGHTNINGLOADER) * 50 : 0 );
RE_LVL_DMOD(100);
if( sc && sc->data[SC_BLAST_OPTION] )
skillratio += sd ? sd->status.job_level * 5 : 0;
@@ -4109,7 +4109,7 @@ struct Damage battle_calc_magic_attack(struct block_list *src,struct block_list
#endif
if(sd) {
//Damage bonuses
- if ((i = iPc->skillatk_bonus(sd, skill_id)))
+ if ((i = pc->skillatk_bonus(sd, skill_id)))
ad.damage += ad.damage*i/100;
if( (i = battle->adjust_skill_damage(src->m,skill_id)) )
@@ -4285,7 +4285,7 @@ struct Damage battle_calc_misc_attack(struct block_list *src,struct block_list *
case HT_CLAYMORETRAP:
md.damage = skill_lv * sstatus->dex * (3+status_get_lv(src)/100) * (1+sstatus->int_/35);
md.damage += md.damage * (rnd()%20-10) / 100;
- md.damage += 40 * (sd?iPc->checkskill(sd,RA_RESEARCHTRAP):0);
+ md.damage += 40 * (sd?pc->checkskill(sd,RA_RESEARCHTRAP):0);
break;
#else
case HT_LANDMINE:
@@ -4302,7 +4302,7 @@ struct Damage battle_calc_misc_attack(struct block_list *src,struct block_list *
case HT_BLITZBEAT:
case SN_FALCONASSAULT:
//Blitz-beat Damage.
- if(!sd || (temp = iPc->checkskill(sd,HT_STEELCROW)) <= 0)
+ if(!sd || (temp = pc->checkskill(sd,HT_STEELCROW)) <= 0)
temp=0;
md.damage=(sstatus->dex/10+sstatus->int_/2+temp*3+40)*2;
if(mflag > 1) //Autocasted Blitz.
@@ -4323,7 +4323,7 @@ struct Damage battle_calc_misc_attack(struct block_list *src,struct block_list *
case BA_DISSONANCE:
md.damage=30+skill_lv*10;
if (sd)
- md.damage+= 3*iPc->checkskill(sd,BA_MUSICALLESSON);
+ md.damage+= 3*pc->checkskill(sd,BA_MUSICALLESSON);
break;
case NPC_SELFDESTRUCTION:
md.damage = sstatus->hp;
@@ -4382,7 +4382,7 @@ struct Damage battle_calc_misc_attack(struct block_list *src,struct block_list *
case RK_DRAGONBREATH:
md.damage = ((status_get_hp(src) / 50) + (status_get_max_sp(src) / 4)) * skill_lv;
RE_LVL_MDMOD(150);
- if (sd) md.damage = md.damage * (100 + 5 * (iPc->checkskill(sd,RK_DRAGONTRAINING) - 1)) / 100;
+ if (sd) md.damage = md.damage * (100 + 5 * (pc->checkskill(sd,RK_DRAGONTRAINING) - 1)) / 100;
md.flag |= BF_LONG|BF_WEAPON;
break;
/**
@@ -4395,7 +4395,7 @@ struct Damage battle_calc_misc_attack(struct block_list *src,struct block_list *
RE_LVL_TMDMOD();
if(sd)
{
- int researchskill_lv = iPc->checkskill(sd,RA_RESEARCHTRAP);
+ int researchskill_lv = pc->checkskill(sd,RA_RESEARCHTRAP);
if(researchskill_lv)
md.damage = md.damage * 20 * researchskill_lv / (skill_id == RA_CLUSTERBOMB?50:100);
else
@@ -4410,7 +4410,7 @@ struct Damage battle_calc_misc_attack(struct block_list *src,struct block_list *
case NC_SELFDESTRUCTION:
{
short totaldef = tstatus->def2 + (short)status_get_def(target);
- md.damage = ( (sd?iPc->checkskill(sd,NC_MAINFRAME):10) + 8 ) * ( skill_lv + 1 ) * ( status_get_sp(src) + sstatus->vit );
+ md.damage = ( (sd?pc->checkskill(sd,NC_MAINFRAME):10) + 8 ) * ( skill_lv + 1 ) * ( status_get_sp(src) + sstatus->vit );
RE_LVL_MDMOD(100);
md.damage += status_get_hp(src) - totaldef;
}
@@ -4420,7 +4420,7 @@ struct Damage battle_calc_misc_attack(struct block_list *src,struct block_list *
break;
case GN_HELLS_PLANT_ATK:
//[{( Hell Plant Skill Level x Casters Base Level ) x 10 } + {( Casters INT x 7 ) / 2 } x { 18 + ( Casters Job Level / 4 )] x ( 5 / ( 10 - Summon Flora Skill Level ))
- md.damage = ( skill_lv * status_get_lv(src) * 10 ) + ( sstatus->int_ * 7 / 2 ) * ( 18 + (sd?sd->status.job_level:0) / 4 ) * ( 5 / (10 - (sd?iPc->checkskill(sd,AM_CANNIBALIZE):0)) );
+ md.damage = ( skill_lv * status_get_lv(src) * 10 ) + ( sstatus->int_ * 7 / 2 ) * ( 18 + (sd?sd->status.job_level:0) / 4 ) * ( 5 / (10 - (sd?pc->checkskill(sd,AM_CANNIBALIZE):0)) );
break;
case KO_HAPPOKUNAI:
{
@@ -4475,7 +4475,7 @@ struct Damage battle_calc_misc_attack(struct block_list *src,struct block_list *
hitrate+= sstatus->hit - flee;
#ifdef RENEWAL
if( sd ) //in Renewal hit bonus from Vultures Eye is not anymore shown in status window
- hitrate += iPc->checkskill(sd,AC_VULTURE);
+ hitrate += pc->checkskill(sd,AC_VULTURE);
#endif
hitrate = cap_value(hitrate, battle_config.min_hitrate, battle_config.max_hitrate);
@@ -4508,7 +4508,7 @@ struct Damage battle_calc_misc_attack(struct block_list *src,struct block_list *
#endif
md.damage = battle->calc_cardfix(BF_MISC, src, target, nk, s_ele, 0, md.damage, 0, md.flag);
- if (sd && (i = iPc->skillatk_bonus(sd, skill_id)))
+ if (sd && (i = pc->skillatk_bonus(sd, skill_id)))
md.damage += md.damage*i/100;
if( (i = battle->adjust_skill_damage(src->m,skill_id)) )
@@ -4559,7 +4559,7 @@ struct Damage battle_calc_misc_attack(struct block_list *src,struct block_list *
if( sd ) {
if ( md.damage > sd->status.zeny )
md.damage = sd->status.zeny;
- iPc->payzeny(sd, md.damage,LOG_TYPE_STEAL,NULL);
+ pc->payzeny(sd, md.damage,LOG_TYPE_STEAL,NULL);
}
break;
}
@@ -4852,7 +4852,7 @@ enum damage_lv battle_weapon_attack(struct block_list* src, struct block_list* t
uint16 skill_lv = tsc->data[SC_BLADESTOP_WAIT]->val1;
int duration = skill->get_time2(MO_BLADESTOP,skill_lv);
status_change_end(target, SC_BLADESTOP_WAIT, INVALID_TIMER);
- if(sc_start4(src, SC_BLADESTOP, 100, sd?iPc->checkskill(sd, MO_BLADESTOP):5, 0, 0, target->id, duration))
+ if(sc_start4(src, SC_BLADESTOP, 100, sd?pc->checkskill(sd, MO_BLADESTOP):5, 0, 0, target->id, duration))
{ //Target locked.
clif->damage(src, target, tick, sstatus->amotion, 1, 0, 1, 0, 0); //Display MISS.
clif->bladestop(target, src->id, 1);
@@ -4861,7 +4861,7 @@ enum damage_lv battle_weapon_attack(struct block_list* src, struct block_list* t
}
}
- if(sd && (skillv = iPc->checkskill(sd,MO_TRIPLEATTACK)) > 0) {
+ if(sd && (skillv = pc->checkskill(sd,MO_TRIPLEATTACK)) > 0) {
int triple_rate= 30 - skillv; //Base Rate
if (sc && sc->data[SC_SKILLRATE_UP] && sc->data[SC_SKILLRATE_UP]->val1 == MO_TRIPLEATTACK) {
triple_rate+= triple_rate*(sc->data[SC_SKILLRATE_UP]->val2)/100;
@@ -4900,13 +4900,13 @@ enum damage_lv battle_weapon_attack(struct block_list* src, struct block_list* t
}
if( sc->data[SC_GT_ENERGYGAIN] ) {
if( sd && rnd()%100 < 10 + 5 * sc->data[SC_GT_ENERGYGAIN]->val1)
- iPc->addspiritball(sd,
+ pc->addspiritball(sd,
skill->get_time(MO_CALLSPIRITS, sc->data[SC_GT_ENERGYGAIN]->val1),
sc->data[SC_GT_ENERGYGAIN]->val1);
}
if( tsc && tsc->data[SC_GT_ENERGYGAIN] ) {
if( tsd && rnd()%100 < 10 + 5 * tsc->data[SC_GT_ENERGYGAIN]->val1)
- iPc->addspiritball(tsd,
+ pc->addspiritball(tsd,
skill->get_time(MO_CALLSPIRITS, tsc->data[SC_GT_ENERGYGAIN]->val1),
tsc->data[SC_GT_ENERGYGAIN]->val1);
}
@@ -4940,7 +4940,7 @@ enum damage_lv battle_weapon_attack(struct block_list* src, struct block_list* t
wd.damage *= 3; // Triple Damage
if( sd && sc->data[SC_FEARBREEZE] && sc->data[SC_FEARBREEZE]->val4 > 0 && sd->status.inventory[sd->equip_index[EQI_AMMO]].amount >= sc->data[SC_FEARBREEZE]->val4 && battle_config.arrow_decrement){
- iPc->delitem(sd,sd->equip_index[EQI_AMMO],sc->data[SC_FEARBREEZE]->val4,0,1,LOG_TYPE_CONSUME);
+ pc->delitem(sd,sd->equip_index[EQI_AMMO],sc->data[SC_FEARBREEZE]->val4,0,1,LOG_TYPE_CONSUME);
sc->data[SC_FEARBREEZE]->val4 = 0;
}
}
@@ -5476,7 +5476,7 @@ int battle_check_target( struct block_list *src, struct block_list *target,int f
{
int s_guild = status_get_guild_id(s_bl);
int t_guild = status_get_guild_id(t_bl);
- if( !(map[m].flag.pvp && map[m].flag.pvp_noguild) && s_guild && t_guild && (s_guild == t_guild || guild->isallied(s_guild, t_guild)) && (!map[m].flag.battleground || sbg_id == tbg_id) )
+ if( !(map[m].flag.pvp && map[m].flag.pvp_noguild) && s_guild && t_guild && (s_guild == t_guild || (!(flag&BCT_SAMEGUILD) && guild->isallied(s_guild, t_guild))) && (!map[m].flag.battleground || sbg_id == tbg_id) )
state |= BCT_GUILD;
else
state |= BCT_ENEMY;
@@ -5509,7 +5509,7 @@ int battle_check_target( struct block_list *src, struct block_list *target,int f
{
int s_guild = status_get_guild_id(s_bl);
int t_guild = status_get_guild_id(t_bl);
- if(s_guild && t_guild && (s_guild == t_guild || guild->isallied(s_guild, t_guild)))
+ if(s_guild && t_guild && (s_guild == t_guild || (!(flag&BCT_SAMEGUILD) && guild->isallied(s_guild, t_guild))))
state |= BCT_GUILD;
}
} //end non pvp/gvg chk rivality
diff --git a/src/map/battle.h b/src/map/battle.h
index 36796c516..f2d870032 100644
--- a/src/map/battle.h
+++ b/src/map/battle.h
@@ -55,16 +55,19 @@ typedef enum damage_lv {
} damage_lv;
enum e_battle_check_target { //New definitions [Skotlex]
- BCT_ENEMY = 0x020000,
- BCT_NOENEMY = 0x1d0000, //This should be (~BCT_ENEMY&BCT_ALL)
- BCT_PARTY = 0x040000,
- BCT_NOPARTY = 0x1b0000, //This should be (~BCT_PARTY&BCT_ALL)
- BCT_GUILD = 0x080000,
- BCT_NOGUILD = 0x170000, //This should be (~BCT_GUILD&BCT_ALL)
- BCT_ALL = 0x1f0000,
- BCT_NOONE = 0x000000,
- BCT_SELF = 0x010000,
- BCT_NEUTRAL = 0x100000,
+ BCT_NOONE = 0x000000,
+ BCT_SELF = 0x010000,
+ BCT_ENEMY = 0x020000,
+ BCT_PARTY = 0x040000,
+ BCT_GUILD = 0x080000,
+ BCT_NEUTRAL = 0x100000,
+ BCT_SAMEGUILD = 0x200000, // No Guild Allies
+
+ BCT_NOGUILD = 0x170000, // This should be (~BCT_GUILD&BCT_ALL)
+ BCT_NOPARTY = 0x1b0000, // This should be (~BCT_PARTY&BCT_ALL)
+ BCT_NOENEMY = 0x1d0000, // This should be (~BCT_ENEMY&BCT_ALL)
+
+ BCT_ALL = 0x1f0000, // Sum of BCT_NOONE to BCT_NEUTRAL
};
/**
diff --git a/src/map/battleground.c b/src/map/battleground.c
index 47fef4376..64bc25269 100644
--- a/src/map/battleground.c
+++ b/src/map/battleground.c
@@ -65,7 +65,7 @@ int bg_team_warp(int bg_id, unsigned short mapindex, short x, short y)
struct battleground_data *bg = bg_team_search(bg_id);
if( bg == NULL ) return 0;
for( i = 0; i < MAX_BG_MEMBERS; i++ )
- if( bg->members[i].sd != NULL ) iPc->setpos(bg->members[i].sd, mapindex, x, y, CLR_TELEPORT);
+ if( bg->members[i].sd != NULL ) pc->setpos(bg->members[i].sd, mapindex, x, y, CLR_TELEPORT);
return 1;
}
@@ -145,7 +145,7 @@ int bg_member_respawn(struct map_session_data *sd)
return 0;
if( bg->mapindex == 0 )
return 0; // Respawn not handled by Core
- iPc->setpos(sd, bg->mapindex, bg->x, bg->y, CLR_OUTSIGHT);
+ pc->setpos(sd, bg->mapindex, bg->x, bg->y, CLR_OUTSIGHT);
status_revive(&sd->bl, 1, 100);
return 1; // Warped
@@ -220,7 +220,7 @@ int bg_send_message(struct map_session_data *sd, const char *mes, int len)
*/
int bg_send_xy_timer_sub(DBKey key, DBData *data, va_list ap)
{
- struct battleground_data *bg = iDB->data2ptr(data);
+ struct battleground_data *bg = DB->data2ptr(data);
struct map_session_data *sd;
int i;
nullpo_ret(bg);
@@ -526,7 +526,7 @@ void bg_queue_add(struct map_session_data *sd, struct bg_arena *arena, enum bg_q
switch( type ) { /* guild/party already validated in can_queue */
case BGQT_PARTY: {
- struct party_data *p = iParty->search(sd->status.party_id);
+ struct party_data *p = party->search(sd->status.party_id);
for( i = 0; i < MAX_PARTY; i++ ) {
if( !p->data[i].sd || p->data[i].sd->bg_queue.arena != NULL ) continue;
count++;
@@ -560,7 +560,7 @@ void bg_queue_add(struct map_session_data *sd, struct bg_arena *arena, enum bg_q
clif->bgqueue_update_info(sd,arena->id,script->hq[arena->queue_id].items);
break;
case BGQT_PARTY: {
- struct party_data *p = iParty->search(sd->status.party_id);
+ struct party_data *p = party->search(sd->status.party_id);
for( i = 0; i < MAX_PARTY; i++ ) {
if( !p->data[i].sd || p->data[i].sd->bg_queue.arena != NULL ) continue;
p->data[i].sd->bg_queue.type = type;
@@ -650,7 +650,7 @@ enum BATTLEGROUNDS_QUEUE_ACK bg_canqueue(struct map_session_data *sd, struct bg_
return BGQA_NOT_PARTY_GUILD_LEADER;
else {
struct party_data *p;
- if( (p = iParty->search(sd->status.party_id) ) ) {
+ if( (p = party->search(sd->status.party_id) ) ) {
int i, count = 0;
bool is_leader = false;
diff --git a/src/map/buyingstore.c b/src/map/buyingstore.c
index 0fed57d37..764b51015 100644
--- a/src/map/buyingstore.c
+++ b/src/map/buyingstore.c
@@ -100,7 +100,7 @@ void buyingstore_create(struct map_session_data* sd, int zenylimit, unsigned cha
return;
}
- if( !iPc->can_give_items(sd) )
+ if( !pc->can_give_items(sd) )
{// custom: GM is not allowed to buy (give zeny)
sd->buyingstore.slots = 0;
clif->message(sd->fd, msg_txt(246));
@@ -147,7 +147,7 @@ void buyingstore_create(struct map_session_data* sd, int zenylimit, unsigned cha
break;
}
- if( !id->flag.buyingstore || !itemdb_cantrade_sub(id, iPc->get_group_level(sd), iPc->get_group_level(sd)) || ( idx = iPc->search_inventory(sd, nameid) ) == -1 )
+ if( !id->flag.buyingstore || !itemdb_cantrade_sub(id, pc->get_group_level(sd), pc->get_group_level(sd)) || ( idx = pc->search_inventory(sd, nameid) ) == -1 )
{// restrictions: allowed, no character-bound items and at least one must be owned
break;
}
@@ -221,7 +221,7 @@ void buyingstore_open(struct map_session_data* sd, int account_id)
return;
}
- if( !iPc->can_give_items(sd) )
+ if( !pc->can_give_items(sd) )
{// custom: GM is not allowed to sell
clif->message(sd->fd, msg_txt(246));
return;
@@ -259,7 +259,7 @@ void buyingstore_trade(struct map_session_data* sd, int account_id, unsigned int
return;
}
- if( !iPc->can_give_items(sd) )
+ if( !pc->can_give_items(sd) )
{// custom: GM is not allowed to sell
clif->message(sd->fd, msg_txt(246));
clif->buyingstore_trade_failed_seller(sd, BUYINGSTORE_TRADE_SELLER_FAILED, 0);
@@ -314,7 +314,7 @@ void buyingstore_trade(struct map_session_data* sd, int account_id, unsigned int
return;
}
- if( sd->status.inventory[index].expire_time || !itemdb_cantrade(&sd->status.inventory[index], iPc->get_group_level(sd), iPc->get_group_level(pl_sd)) || memcmp(sd->status.inventory[index].card, buyingstore_blankslots, sizeof(buyingstore_blankslots)) )
+ if( sd->status.inventory[index].expire_time || !itemdb_cantrade(&sd->status.inventory[index], pc->get_group_level(sd), pc->get_group_level(pl_sd)) || memcmp(sd->status.inventory[index].card, buyingstore_blankslots, sizeof(buyingstore_blankslots)) )
{// non-tradable item
clif->buyingstore_trade_failed_seller(sd, BUYINGSTORE_TRADE_SELLER_FAILED, nameid);
return;
@@ -333,7 +333,7 @@ void buyingstore_trade(struct map_session_data* sd, int account_id, unsigned int
return;
}
- if( iPc->checkadditem(pl_sd, nameid, amount) == ADDITEM_OVERAMOUNT )
+ if( pc->checkadditem(pl_sd, nameid, amount) == ADDITEM_OVERAMOUNT )
{// buyer does not have enough space for this item
clif->buyingstore_trade_failed_seller(sd, BUYINGSTORE_TRADE_SELLER_FAILED, nameid);
return;
@@ -369,13 +369,13 @@ void buyingstore_trade(struct map_session_data* sd, int account_id, unsigned int
zeny = amount*pl_sd->buyingstore.items[listidx].price;
// move item
- iPc->additem(pl_sd, &sd->status.inventory[index], amount, LOG_TYPE_BUYING_STORE);
- iPc->delitem(sd, index, amount, 1, 0, LOG_TYPE_BUYING_STORE);
+ pc->additem(pl_sd, &sd->status.inventory[index], amount, LOG_TYPE_BUYING_STORE);
+ pc->delitem(sd, index, amount, 1, 0, LOG_TYPE_BUYING_STORE);
pl_sd->buyingstore.items[listidx].amount-= amount;
// pay up
- iPc->payzeny(pl_sd, zeny, LOG_TYPE_BUYING_STORE, sd);
- iPc->getzeny(sd, zeny, LOG_TYPE_BUYING_STORE, pl_sd);
+ pc->payzeny(pl_sd, zeny, LOG_TYPE_BUYING_STORE, sd);
+ pc->getzeny(sd, zeny, LOG_TYPE_BUYING_STORE, pl_sd);
pl_sd->buyingstore.zenylimit-= zeny;
// notify clients
diff --git a/src/map/chrif.c b/src/map/chrif.c
index 8a70b4931..6e076e6d8 100644
--- a/src/map/chrif.c
+++ b/src/map/chrif.c
@@ -53,7 +53,7 @@ static const int packet_len_table[0x3d] = { // U - used, F - free
//2af9: Incoming, chrif_connectack -> 'answer of the 2af8 login(ok / fail)'
//2afa: Outgoing, chrif_sendmap -> 'sending our maps'
//2afb: Incoming, chrif_sendmapack -> 'Maps received successfully / or not ..'
-//2afc: Outgoing, chrif_scdata_request -> request sc_data for iPc->authok'ed char. <- new command reuses previous one.
+//2afc: Outgoing, chrif_scdata_request -> request sc_data for pc->authok'ed char. <- new command reuses previous one.
//2afd: Incoming, chrif_authok -> 'client authentication ok'
//2afe: Outgoing, send_usercount_tochar -> 'sends player count of this map server to charserver'
//2aff: Outgoing, send_users_tochar -> 'sends all actual connected character ids to charserver'
@@ -272,7 +272,7 @@ int chrif_isconnected(void) {
int chrif_save(struct map_session_data *sd, int flag) {
nullpo_retr(-1, sd);
- iPc->makesavestatus(sd);
+ pc->makesavestatus(sd);
if (flag && sd->state.active) { //Store player data which is quitting
//FIXME: SC are lost if there's no connection at save-time because of the way its related data is cleared immediately after this function. [Skotlex]
@@ -479,12 +479,12 @@ int chrif_connectack(int fd) {
* @see DBApply
*/
static int chrif_reconnect(DBKey key, DBData *data, va_list ap) {
- struct auth_node *node = iDB->data2ptr(data);
+ struct auth_node *node = DB->data2ptr(data);
switch (node->state) {
case ST_LOGIN:
if ( node->sd && node->char_dat == NULL ) {//Since there is no way to request the char auth, make it fail.
- iPc->authfail(node->sd);
+ pc->authfail(node->sd);
chrif_char_offline(node->sd);
chrif_auth_delete(node->account_id, node->char_id, ST_LOGIN);
}
@@ -645,10 +645,10 @@ void chrif_authok(int fd) {
node->char_id == char_id &&
node->login_id1 == login_id1 )
{ //Auth Ok
- if (iPc->authok(sd, login_id2, expiration_time, group_id, status, changing_mapservers))
+ if (pc->authok(sd, login_id2, expiration_time, group_id, status, changing_mapservers))
return;
} else { //Auth Failed
- iPc->authfail(sd);
+ pc->authfail(sd);
}
chrif_char_offline(sd); //Set him offline, the char server likely has it set as online already.
@@ -687,7 +687,7 @@ void chrif_authfail(int fd) {/* HELLO WORLD. ip in RFIFOL 15 is not being used (
* @see DBApply
*/
int auth_db_cleanup_sub(DBKey key, DBData *data, va_list ap) {
- struct auth_node *node = iDB->data2ptr(data);
+ struct auth_node *node = DB->data2ptr(data);
const char* states[] = { "Login", "Logout", "Map change" };
if(DIFF_TICK(iTimer->gettick(),node->node_created)>60000) {
@@ -949,14 +949,14 @@ int chrif_divorceack(int char_id, int partner_id) {
sd->status.partner_id = 0;
for(i = 0; i < MAX_INVENTORY; i++)
if (sd->status.inventory[i].nameid == WEDDING_RING_M || sd->status.inventory[i].nameid == WEDDING_RING_F)
- iPc->delitem(sd, i, 1, 0, 0, LOG_TYPE_OTHER);
+ pc->delitem(sd, i, 1, 0, 0, LOG_TYPE_OTHER);
}
if( ( sd = iMap->charid2sd(partner_id) ) != NULL && sd->status.partner_id == char_id ) {
sd->status.partner_id = 0;
for(i = 0; i < MAX_INVENTORY; i++)
if (sd->status.inventory[i].nameid == WEDDING_RING_M || sd->status.inventory[i].nameid == WEDDING_RING_F)
- iPc->delitem(sd, i, 1, 0, 0, LOG_TYPE_OTHER);
+ pc->delitem(sd, i, 1, 0, 0, LOG_TYPE_OTHER);
}
return 0;
@@ -1595,7 +1595,7 @@ void chrif_send_report(char* buf, int len) {
* @see DBApply
*/
int auth_db_final(DBKey key, DBData *data, va_list ap) {
- struct auth_node *node = iDB->data2ptr(data);
+ struct auth_node *node = DB->data2ptr(data);
if (node->char_dat)
aFree(node->char_dat);
diff --git a/src/map/clif.c b/src/map/clif.c
index 39ffdd23d..202469605 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -403,7 +403,7 @@ int clif_send(const void* buf, int len, struct block_list* bl, enum send_target
case PARTY_SAMEMAP:
case PARTY_SAMEMAP_WOS:
if (sd && sd->status.party_id)
- p = iParty->search(sd->status.party_id);
+ p = party->search(sd->status.party_id);
if (p) {
for(i=0;i<MAX_PARTY;i++){
@@ -1763,7 +1763,7 @@ void clif_buylist(struct map_session_data *sd, struct npc_data *nd)
if( id == NULL )
continue;
WFIFOL(fd, 4+c*11) = val;
- WFIFOL(fd, 8+c*11) = iPc->modifybuyvalue(sd,val);
+ WFIFOL(fd, 8+c*11) = pc->modifybuyvalue(sd,val);
WFIFOB(fd,12+c*11) = itemtype(id->type);
WFIFOW(fd,13+c*11) = ( id->view_id > 0 ) ? id->view_id : id->nameid;
c++;
@@ -1806,7 +1806,7 @@ void clif_selllist(struct map_session_data *sd)
{
if( sd->status.inventory[i].nameid > 0 && sd->inventory_data[i] )
{
- if( !itemdb_cansell(&sd->status.inventory[i], iPc->get_group_level(sd)) )
+ if( !itemdb_cansell(&sd->status.inventory[i], pc->get_group_level(sd)) )
continue;
if( sd->status.inventory[i].expire_time )
@@ -1817,7 +1817,7 @@ void clif_selllist(struct map_session_data *sd)
continue;
WFIFOW(fd,4+c*10)=i+2;
WFIFOL(fd,6+c*10)=val;
- WFIFOL(fd,10+c*10)=iPc->modifysellvalue(sd,val);
+ WFIFOL(fd,10+c*10)=pc->modifysellvalue(sd,val);
c++;
}
}
@@ -2233,7 +2233,7 @@ void clif_additem(struct map_session_data *sd, int n, int amount, int fail) {
p.IsDamaged = sd->status.inventory[n].attribute;
p.refiningLevel =sd->status.inventory[n].refine;
clif->addcards2(&p.slot.card[0], &sd->status.inventory[n]);
- p.location = iPc->equippoint(sd,n);
+ p.location = pc->equippoint(sd,n);
p.type = itemtype(sd->inventory_data[n]->type);
#if PACKETVER >= 20061218
p.HireExpireDate = sd->status.inventory[n].expire_time;
@@ -2353,7 +2353,7 @@ void clif_inventorylist(struct map_session_data *sd) {
if( !itemdb_isstackable2(sd->inventory_data[i]) )
{ //Non-stackable (Equippable)
WBUFW(bufe,ne*se+4)=i+2;
- clif->item_sub(bufe, ne*se+6, &sd->status.inventory[i], sd->inventory_data[i], iPc->equippoint(sd,i));
+ clif->item_sub(bufe, ne*se+6, &sd->status.inventory[i], sd->inventory_data[i], pc->equippoint(sd,i));
clif->addcards(WBUFP(bufe, ne*se+16), &sd->status.inventory[i]);
#if PACKETVER >= 20071002
WBUFL(bufe,ne*se+24)=sd->status.inventory[i].expire_time;
@@ -2443,7 +2443,7 @@ void clif_equiplist(struct map_session_data *sd)
continue;
//Equippable
WBUFW(buf,n*cmd+4)=i+2;
- clif->item_sub(buf, n*cmd+6, &sd->status.inventory[i], sd->inventory_data[i], iPc->equippoint(sd,i));
+ clif->item_sub(buf, n*cmd+6, &sd->status.inventory[i], sd->inventory_data[i], pc->equippoint(sd,i));
clif->addcards(WBUFP(buf, n*cmd+16), &sd->status.inventory[i]);
#if PACKETVER >= 20071002
WBUFL(buf,n*cmd+24)=sd->status.inventory[i].expire_time;
@@ -2980,9 +2980,9 @@ void clif_updatestatus(struct map_session_data *sd,int type)
switch(type){
// 00b0
case SP_WEIGHT:
- iPc->updateweightstatus(sd);
+ pc->updateweightstatus(sd);
WFIFOHEAD(fd,14);
- WFIFOW(fd,0)=0xb0; //Need to re-set as iPc->updateweightstatus can alter the buffer. [Skotlex]
+ WFIFOW(fd,0)=0xb0; //Need to re-set as pc->updateweightstatus can alter the buffer. [Skotlex]
WFIFOW(fd,2)=type;
WFIFOL(fd,4)=sd->weight;
break;
@@ -3092,11 +3092,11 @@ void clif_updatestatus(struct map_session_data *sd,int type)
break;
case SP_NEXTBASEEXP:
WFIFOW(fd,0)=0xb1;
- WFIFOL(fd,4)=iPc->nextbaseexp(sd);
+ WFIFOL(fd,4)=pc->nextbaseexp(sd);
break;
case SP_NEXTJOBEXP:
WFIFOW(fd,0)=0xb1;
- WFIFOL(fd,4)=iPc->nextjobexp(sd);
+ WFIFOL(fd,4)=pc->nextjobexp(sd);
break;
/**
@@ -3109,7 +3109,7 @@ void clif_updatestatus(struct map_session_data *sd,int type)
case SP_UDEX:
case SP_ULUK:
WFIFOW(fd,0)=0xbe;
- WFIFOB(fd,4)=iPc->need_status_point(sd,type-SP_USTR+SP_STR,1);
+ WFIFOB(fd,4)=pc->need_status_point(sd,type-SP_USTR+SP_STR,1);
len=5;
break;
@@ -3406,17 +3406,17 @@ void clif_initialstatus(struct map_session_data *sd) {
WBUFW(buf,0)=0xbd;
WBUFW(buf,2)=min(sd->status.status_point, INT16_MAX);
WBUFB(buf,4)=min(sd->status.str, UINT8_MAX);
- WBUFB(buf,5)=iPc->need_status_point(sd,SP_STR,1);
+ WBUFB(buf,5)=pc->need_status_point(sd,SP_STR,1);
WBUFB(buf,6)=min(sd->status.agi, UINT8_MAX);
- WBUFB(buf,7)=iPc->need_status_point(sd,SP_AGI,1);
+ WBUFB(buf,7)=pc->need_status_point(sd,SP_AGI,1);
WBUFB(buf,8)=min(sd->status.vit, UINT8_MAX);
- WBUFB(buf,9)=iPc->need_status_point(sd,SP_VIT,1);
+ WBUFB(buf,9)=pc->need_status_point(sd,SP_VIT,1);
WBUFB(buf,10)=min(sd->status.int_, UINT8_MAX);
- WBUFB(buf,11)=iPc->need_status_point(sd,SP_INT,1);
+ WBUFB(buf,11)=pc->need_status_point(sd,SP_INT,1);
WBUFB(buf,12)=min(sd->status.dex, UINT8_MAX);
- WBUFB(buf,13)=iPc->need_status_point(sd,SP_DEX,1);
+ WBUFB(buf,13)=pc->need_status_point(sd,SP_DEX,1);
WBUFB(buf,14)=min(sd->status.luk, UINT8_MAX);
- WBUFB(buf,15)=iPc->need_status_point(sd,SP_LUK,1);
+ WBUFB(buf,15)=pc->need_status_point(sd,SP_LUK,1);
WBUFW(buf,16) = pc_leftside_atk(sd);
WBUFW(buf,18) = pc_rightside_atk(sd);
@@ -3508,7 +3508,7 @@ void clif_arrow_create_list(struct map_session_data *sd)
for (i = 0, c = 0; i < MAX_SKILL_ARROW_DB; i++) {
if (skill_arrow_db[i].nameid > 0 &&
- (j = iPc->search_inventory(sd, skill_arrow_db[i].nameid)) >= 0 &&
+ (j = pc->search_inventory(sd, skill_arrow_db[i].nameid)) >= 0 &&
!sd->status.inventory[j].equip && sd->status.inventory[j].identify)
{
if ((j = itemdb_viewid(skill_arrow_db[i].nameid)) > 0)
@@ -5932,7 +5932,7 @@ void clif_wis_message(int fd, const char* nick, const char* mes, int mes_len)
WFIFOW(fd,2) = mes_len + NAME_LENGTH + 8;
safestrncpy((char*)WFIFOP(fd,4), nick, NAME_LENGTH);
WFIFOL(fd,28) = 0; // isAdmin; if nonzero, also displays text above char
- // TODO: WFIFOL(fd,28) = iPc->get_group_level(ssd);
+ // TODO: WFIFOL(fd,28) = pc->get_group_level(ssd);
safestrncpy((char*)WFIFOP(fd,32), mes, mes_len);
WFIFOSET(fd,WFIFOW(fd,2));
#endif
@@ -6167,14 +6167,14 @@ void clif_item_refine_list(struct map_session_data *sd)
nullpo_retv(sd);
- skill_lv = iPc->checkskill(sd,WS_WEAPONREFINE);
+ skill_lv = pc->checkskill(sd,WS_WEAPONREFINE);
fd=sd->fd;
refine_item[0] = -1;
- refine_item[1] = iPc->search_inventory(sd,1010);
- refine_item[2] = iPc->search_inventory(sd,1011);
- refine_item[3] = refine_item[4] = iPc->search_inventory(sd,984);
+ refine_item[1] = pc->search_inventory(sd,1010);
+ refine_item[2] = pc->search_inventory(sd,1011);
+ refine_item[3] = refine_item[4] = pc->search_inventory(sd,984);
WFIFOHEAD(fd, MAX_INVENTORY * 13 + 4);
WFIFOW(fd,0)=0x221;
@@ -6610,7 +6610,7 @@ void clif_party_invite(struct map_session_data *sd,struct map_session_data *tsd)
fd=tsd->fd;
- if( (p=iParty->search(sd->status.party_id))==NULL )
+ if( (p=party->search(sd->status.party_id))==NULL )
return;
WFIFOHEAD(fd,packet_len(cmd));
@@ -7086,31 +7086,31 @@ void clif_autospell(struct map_session_data *sd,uint16 skill_lv)
WFIFOHEAD(fd,packet_len(0x1cd));
WFIFOW(fd, 0)=0x1cd;
- if(skill_lv>0 && iPc->checkskill(sd,MG_NAPALMBEAT)>0)
+ if(skill_lv>0 && pc->checkskill(sd,MG_NAPALMBEAT)>0)
WFIFOL(fd,2)= MG_NAPALMBEAT;
else
WFIFOL(fd,2)= 0x00000000;
- if(skill_lv>1 && iPc->checkskill(sd,MG_COLDBOLT)>0)
+ if(skill_lv>1 && pc->checkskill(sd,MG_COLDBOLT)>0)
WFIFOL(fd,6)= MG_COLDBOLT;
else
WFIFOL(fd,6)= 0x00000000;
- if(skill_lv>1 && iPc->checkskill(sd,MG_FIREBOLT)>0)
+ if(skill_lv>1 && pc->checkskill(sd,MG_FIREBOLT)>0)
WFIFOL(fd,10)= MG_FIREBOLT;
else
WFIFOL(fd,10)= 0x00000000;
- if(skill_lv>1 && iPc->checkskill(sd,MG_LIGHTNINGBOLT)>0)
+ if(skill_lv>1 && pc->checkskill(sd,MG_LIGHTNINGBOLT)>0)
WFIFOL(fd,14)= MG_LIGHTNINGBOLT;
else
WFIFOL(fd,14)= 0x00000000;
- if(skill_lv>4 && iPc->checkskill(sd,MG_SOULSTRIKE)>0)
+ if(skill_lv>4 && pc->checkskill(sd,MG_SOULSTRIKE)>0)
WFIFOL(fd,18)= MG_SOULSTRIKE;
else
WFIFOL(fd,18)= 0x00000000;
- if(skill_lv>7 && iPc->checkskill(sd,MG_FIREBALL)>0)
+ if(skill_lv>7 && pc->checkskill(sd,MG_FIREBALL)>0)
WFIFOL(fd,22)= MG_FIREBALL;
else
WFIFOL(fd,22)= 0x00000000;
- if(skill_lv>9 && iPc->checkskill(sd,MG_FROSTDIVER)>0)
+ if(skill_lv>9 && pc->checkskill(sd,MG_FROSTDIVER)>0)
WFIFOL(fd,26)= MG_FROSTDIVER;
else
WFIFOL(fd,26)= 0x00000000;
@@ -7149,7 +7149,7 @@ void clif_devotion(struct block_list *src, struct map_session_data *tsd)
for( i = 0; i < 5; i++ )
WBUFL(buf,6+4*i) = sd->devotion[i];
- WBUFW(buf,26) = skill->get_range2(src, CR_DEVOTION, iPc->checkskill(sd, CR_DEVOTION));
+ WBUFW(buf,26) = skill->get_range2(src, CR_DEVOTION, pc->checkskill(sd, CR_DEVOTION));
}
if( tsd )
@@ -8531,8 +8531,8 @@ void clif_refresh(struct map_session_data *sd)
if( disguised(&sd->bl) ) {/* refresh-da */
short disguise = sd->disguise;
- iPc->disguise(sd, -1);
- iPc->disguise(sd, disguise);
+ pc->disguise(sd, -1);
+ pc->disguise(sd, disguise);
}
}
@@ -8571,7 +8571,7 @@ void clif_charnameack (int fd, struct block_list *bl)
memcpy(WBUFP(buf,6), ssd->status.name, NAME_LENGTH);
if( ssd->status.party_id ) {
- p = iParty->search(ssd->status.party_id);
+ p = party->search(ssd->status.party_id);
}
if( ssd->status.guild_id ) {
if( ( g = ssd->guild ) != NULL ) {
@@ -8695,10 +8695,10 @@ void clif_charnameupdate (struct map_session_data *ssd)
if (!battle_config.display_party_name) {
if (ssd->status.party_id > 0 && ssd->status.guild_id > 0 && (g = ssd->guild) != NULL)
- p = iParty->search(ssd->status.party_id);
+ p = party->search(ssd->status.party_id);
}else{
if (ssd->status.party_id > 0)
- p = iParty->search(ssd->status.party_id);
+ p = party->search(ssd->status.party_id);
}
if( ssd->status.guild_id > 0 && (g = ssd->guild) != NULL )
@@ -8884,7 +8884,7 @@ void clif_feel_info(struct map_session_data* sd, unsigned char feel_level, unsig
void clif_hate_info(struct map_session_data *sd, unsigned char hate_level,int class_, unsigned char type)
{
if( pcdb_checkid(class_) ) {
- clif->starskill(sd, iPc->job_name(class_), class_, hate_level, type ? 10 : 11);
+ clif->starskill(sd, pc->job_name(class_), class_, hate_level, type ? 10 : 11);
} else if( mobdb_checkid(class_) ) {
clif->starskill(sd, mob_db(class_)->jname, class_, hate_level, type ? 10 : 11);
} else {
@@ -8935,7 +8935,7 @@ void clif_equiptickack(struct map_session_data* sd, int flag)
/// open equip window:
/// 0 = disabled
/// 1 = enabled
-void clif_equipcheckbox(struct map_session_data* sd)
+void clif_equpcheckbox(struct map_session_data* sd)
{
int fd;
nullpo_retv(sd);
@@ -8999,7 +8999,7 @@ void clif_viewequip_ack(struct map_session_data* sd, struct map_session_data* ts
// Inventory position
WBUFW(buf, n*s+43) = i + 2;
// Add refine, identify flag, element, etc.
- clif->item_sub(WBUFP(buf,0), n*s+45, &tsd->status.inventory[i], tsd->inventory_data[i], iPc->equippoint(tsd, i));
+ clif->item_sub(WBUFP(buf,0), n*s+45, &tsd->status.inventory[i], tsd->inventory_data[i], pc->equippoint(tsd, i));
// Add cards
clif->addcards(WBUFP(buf, n*s+55), &tsd->status.inventory[i]);
// Expiration date stuff, if all of those are set to 0 then the client doesn't show anything related (6 bytes)
@@ -9271,7 +9271,7 @@ void clif_parse_WantToConnection(int fd, struct map_session_data* sd) {
sd->fd = fd;
session[fd]->session_data = sd;
- iPc->setnewpc(sd, account_id, char_id, login_id1, client_tick, sex, fd);
+ pc->setnewpc(sd, account_id, char_id, login_id1, client_tick, sex, fd);
#if PACKETVER < 20070521
WFIFOHEAD(fd,4);
@@ -9317,7 +9317,7 @@ void clif_parse_LoadEndAck(int fd,struct map_session_data *sd)
return;
if (!sd->state.active) { //Character loading is not complete yet!
- //Let iPc->reg_received reinvoke this when ready.
+ //Let pc->reg_received reinvoke this when ready.
sd->state.connect_new = 0;
return;
}
@@ -9342,8 +9342,8 @@ void clif_parse_LoadEndAck(int fd,struct map_session_data *sd)
if(sd->vd.cloth_color)
clif->refreshlook(&sd->bl,sd->bl.id,LOOK_CLOTHES_COLOR,sd->vd.cloth_color,SELF);
// item
- clif->inventorylist(sd); // inventory list first, otherwise deleted items in iPc->checkitem show up as 'unknown item'
- iPc->checkitem(sd);
+ clif->inventorylist(sd); // inventory list first, otherwise deleted items in pc->checkitem show up as 'unknown item'
+ pc->checkitem(sd);
// cart
if(pc_iscarton(sd)) {
@@ -9361,7 +9361,7 @@ void clif_parse_LoadEndAck(int fd,struct map_session_data *sd)
guild->send_memberinfoshort(sd,1);
if(battle_config.pc_invincible_time > 0) {
- iPc->setinvincibletimer(sd,battle_config.pc_invincible_time);
+ pc->setinvincibletimer(sd,battle_config.pc_invincible_time);
}
if( map[sd->bl.m].users++ == 0 && battle_config.dynamic_mobs )
@@ -9384,7 +9384,7 @@ void clif_parse_LoadEndAck(int fd,struct map_session_data *sd)
// Party
// (needs to go after clif_spawn() to show hp bars correctly)
if(sd->status.party_id) {
- iParty->send_movemap(sd);
+ party->send_movemap(sd);
clif->party_hp(sd); // Show hp after displacement [LuzZza]
}
@@ -9393,7 +9393,7 @@ void clif_parse_LoadEndAck(int fd,struct map_session_data *sd)
if(map[sd->bl.m].flag.pvp && !(sd->sc.option&OPTION_INVISIBLE)) {
if(!battle_config.pk_mode) { // remove pvp stuff for pk_mode [Valaris]
if (!map[sd->bl.m].flag.pvp_nocalcrank)
- sd->pvp_timer = iTimer->add_timer(iTimer->gettick()+200, iPc->calc_pvprank_timer, sd->bl.id, 0);
+ sd->pvp_timer = iTimer->add_timer(iTimer->gettick()+200, pc->calc_pvprank_timer, sd->bl.id, 0);
sd->pvp_rank = 0;
sd->pvp_lastusers = 0;
sd->pvp_point = 5;
@@ -9484,7 +9484,7 @@ void clif_parse_LoadEndAck(int fd,struct map_session_data *sd)
sc_start(&sd->bl,SC_NOCHAT,100,0,0);
//Auron reported that This skill only triggers when you logon on the map o.O [Skotlex]
- if ((lv = iPc->checkskill(sd,SG_KNOWLEDGE)) > 0) {
+ if ((lv = pc->checkskill(sd,SG_KNOWLEDGE)) > 0) {
if(sd->bl.m == sd->feel_map[0].m
|| sd->bl.m == sd->feel_map[1].m
|| sd->bl.m == sd->feel_map[2].m)
@@ -9528,7 +9528,7 @@ void clif_parse_LoadEndAck(int fd,struct map_session_data *sd)
if( sd->state.changemap ) {// restore information that gets lost on map-change
#if PACKETVER >= 20070918
clif->partyinvitationstate(sd);
- clif->equipcheckbox(sd);
+ clif->equpcheckbox(sd);
#endif
if( (battle_config.bg_flee_penalty != 100 || battle_config.gvg_flee_penalty != 100) &&
(map_flag_gvg(sd->state.pmap) || map_flag_gvg(sd->bl.m) || map[sd->state.pmap].flag.battleground || map[sd->bl.m].flag.battleground) )
@@ -9585,7 +9585,7 @@ void clif_parse_LoadEndAck(int fd,struct map_session_data *sd)
if(map[sd->bl.m].flag.loadevent) // Lance
npc_script_event(sd, NPCE_LOADMAP);
- if (iPc->checkskill(sd, SG_DEVIL) && !iPc->nextjobexp(sd)) //blindness [Komurka]
+ if (pc->checkskill(sd, SG_DEVIL) && !pc->nextjobexp(sd)) //blindness [Komurka]
clif->sc_end(&sd->bl, sd->bl.id, SELF, SI_DEVIL);
if (sd->sc.opt2) //Client loses these on warp.
@@ -9748,7 +9748,7 @@ void clif_parse_WalkToXY(int fd, struct map_session_data *sd)
if(sd->sc.data[SC_RUN] || sd->sc.data[SC_WUGDASH])
return;
- iPc->delinvincibletimer(sd);
+ pc->delinvincibletimer(sd);
RFIFOPOS(fd, packet_db[RFIFOW(fd,0)].pos[0], &x, &y, NULL);
@@ -9819,7 +9819,7 @@ void clif_parse_GetCharNameRequest(int fd, struct map_session_data *sd)
sc = status_get_sc(bl);
if (sc && sc->option&OPTION_INVISIBLE && !disguised(bl) &&
bl->type != BL_NPC && //Skip hidden NPCs which can be seen using Maya Purple
- iPc->get_group_level(sd) < battle_config.hack_info_GM_level
+ pc->get_group_level(sd) < battle_config.hack_info_GM_level
) {
char gm_msg[256];
sprintf(gm_msg, "Hack on NameRequest: character '%s' (account: %d) requested the name of an invisible target (id: %d).\n", sd->status.name, sd->status.account_id, id);
@@ -9837,7 +9837,7 @@ int clif_undisguise_timer(int tid, unsigned int tick, int id, intptr_t data) {
if( (sd = iMap->id2sd(id)) ) {
sd->fontcolor_tid = INVALID_TIMER;
if( sd->fontcolor && sd->disguise == sd->status.class_ )
- iPc->disguise(sd,-1);
+ pc->disguise(sd,-1);
}
return 0;
}
@@ -9862,7 +9862,7 @@ void clif_parse_GlobalMessage(int fd, struct map_session_data* sd)
if( atcommand->parse(fd, sd, message, 1) )
return;
- if( sd->sc.data[SC_BERSERK] || sd->sc.data[SC__BLOODYLUST] || (sd->sc.data[SC_NOCHAT] && sd->sc.data[SC_NOCHAT]->val1&MANNER_NOCHAT) )
+ if( sd->sc.data[SC_BERSERK] || sd->sc.data[SC_DEEPSLEEP] || sd->sc.data[SC__BLOODYLUST] || (sd->sc.data[SC_NOCHAT] && sd->sc.data[SC_NOCHAT]->val1&MANNER_NOCHAT) )
return;
if( battle_config.min_chat_delay ) { //[Skotlex]
@@ -9880,7 +9880,7 @@ void clif_parse_GlobalMessage(int fd, struct map_session_data* sd)
if( sd->disguise == -1 ) {
sd->fontcolor_tid = iTimer->add_timer(iTimer->gettick()+5000, clif->undisguise_timer, sd->bl.id, 0);
- iPc->disguise(sd,sd->status.class_);
+ pc->disguise(sd,sd->status.class_);
if( pc_isdead(sd) )
clif_clearunit_single(-sd->bl.id, CLR_DEAD, sd->fd);
if( unit_is_walking(&sd->bl) )
@@ -10019,7 +10019,7 @@ void clif_parse_Emotion(int fd, struct map_session_data *sd)
{
int emoticon = RFIFOB(fd,packet_db[RFIFOW(fd,0)].pos[0]);
- if (battle_config.basic_skill_check == 0 || iPc->checkskill(sd, NV_BASIC) >= 2) {
+ if (battle_config.basic_skill_check == 0 || pc->checkskill(sd, NV_BASIC) >= 2) {
if (emoticon == E_MUTE) {// prevent use of the mute emote [Valaris]
clif->skill_fail(sd, 1, USESKILL_FAIL_LEVEL, 1);
return;
@@ -10098,19 +10098,19 @@ void clif_parse_ActionRequest_sub(struct map_session_data *sd, int action_type,
if( sd->sc.data[SC_BASILICA] || sd->sc.data[SC__SHADOWFORM] )
return;
- if (!battle_config.sdelay_attack_enable && iPc->checkskill(sd, SA_FREECAST) <= 0) {
+ if (!battle_config.sdelay_attack_enable && pc->checkskill(sd, SA_FREECAST) <= 0) {
if (DIFF_TICK(tick, sd->ud.canact_tick) < 0) {
clif->skill_fail(sd, 1, USESKILL_FAIL_SKILLINTERVAL, 0);
return;
}
}
- iPc->delinvincibletimer(sd);
+ pc->delinvincibletimer(sd);
sd->idletime = last_tick;
unit_attack(&sd->bl, target_id, action_type != 0);
break;
case 0x02: // sitdown
- if (battle_config.basic_skill_check && iPc->checkskill(sd, NV_BASIC) < 3) {
+ if (battle_config.basic_skill_check && pc->checkskill(sd, NV_BASIC) < 3) {
clif->skill_fail(sd, 1, USESKILL_FAIL_LEVEL, 2);
break;
}
@@ -10140,7 +10140,7 @@ void clif_parse_ActionRequest_sub(struct map_session_data *sd, int action_type,
clif->standing(&sd->bl);
return;
}
- iPc->setstand(sd);
+ pc->setstand(sd);
skill->sit(sd,0);
clif->standing(&sd->bl);
break;
@@ -10288,7 +10288,7 @@ void clif_parse_ActionRequest(int fd, struct map_session_data *sd)
void clif_parse_Restart(int fd, struct map_session_data *sd) {
switch(RFIFOB(fd,2)) {
case 0x00:
- iPc->respawn(sd,CLR_RESPAWN);
+ pc->respawn(sd,CLR_RESPAWN);
break;
case 0x01:
/* Rovert's Prevent logout option - Fixed [Valaris] */
@@ -10321,7 +10321,7 @@ void clif_parse_WisMessage(int fd, struct map_session_data* sd)
if ( atcommand->parse(fd, sd, message, 1) )
return;
- if (sd->sc.data[SC_BERSERK] || sd->sc.data[SC__BLOODYLUST] || (sd->sc.data[SC_NOCHAT] && sd->sc.data[SC_NOCHAT]->val1&MANNER_NOCHAT))
+ if (sd->sc.data[SC_BERSERK] || sd->sc.data[SC_DEEPSLEEP] || sd->sc.data[SC__BLOODYLUST] || (sd->sc.data[SC_NOCHAT] && sd->sc.data[SC_NOCHAT]->val1&MANNER_NOCHAT))
return;
if (battle_config.min_chat_delay) { //[Skotlex]
@@ -10431,7 +10431,7 @@ void clif_parse_WisMessage(int fd, struct map_session_data* sd)
// if player ignores everyone
if (dstsd->state.ignoreAll) {
- if (dstsd->sc.option & OPTION_INVISIBLE && iPc->get_group_level(sd) < iPc->get_group_level(dstsd))
+ if (dstsd->sc.option & OPTION_INVISIBLE && pc->get_group_level(sd) < pc->get_group_level(dstsd))
clif->wis_end(fd, 1); // 1: target character is not loged in
else
clif->wis_end(fd, 3); // 3: everyone ignored by target
@@ -10512,7 +10512,7 @@ void clif_parse_TakeItem(int fd, struct map_session_data *sd)
if (pc_cant_act(sd))
break;
- if (!iPc->takeitem(sd, fitem))
+ if (!pc->takeitem(sd, fitem))
break;
return;
@@ -10545,7 +10545,7 @@ void clif_parse_DropItem(int fd, struct map_session_data *sd)
))
break;
- if (!iPc->dropitem(sd, item_index, item_amount))
+ if (!pc->dropitem(sd, item_index, item_amount))
break;
return;
@@ -10578,7 +10578,7 @@ void clif_parse_UseItem(int fd, struct map_session_data *sd)
if(n <0 || n >= MAX_INVENTORY)
return;
- if (!iPc->useitem(sd,n))
+ if (!pc->useitem(sd,n))
clif->useitemack(sd,n,0,false); //Send an empty ack packet or the client gets stuck.
}
@@ -10620,9 +10620,9 @@ void clif_parse_EquipItem(int fd,struct map_session_data *sd)
//Client doesn't send the position for ammo.
if(sd->inventory_data[index]->type == IT_AMMO)
- iPc->equipitem(sd,index,EQP_AMMO);
+ pc->equipitem(sd,index,EQP_AMMO);
else
- iPc->equipitem(sd,index,RFIFOW(fd,4));
+ pc->equipitem(sd,index,RFIFOW(fd,4));
}
void clif_hercules_chsys_delete(struct hChSysCh *channel) {
@@ -10735,7 +10735,7 @@ void clif_parse_UnequipItem(int fd,struct map_session_data *sd)
index = RFIFOW(fd,2)-2;
- iPc->unequipitem(sd,index,1);
+ pc->unequipitem(sd,index,1);
}
@@ -10747,22 +10747,24 @@ void clif_parse_NpcClicked(int fd,struct map_session_data *sd)
{
struct block_list *bl;
- if(pc_isdead(sd)) {
+ if( pc_isdead(sd) ) {
clif_clearunit_area(&sd->bl,CLR_DEAD);
return;
}
- if ( pc_cant_act2(sd) )
+ if ( pc_cant_act2(sd) || !(bl = iMap->id2bl(RFIFOL(fd,2))) )
return;
-
- bl = iMap->id2bl(RFIFOL(fd,2));
- if (!bl) return;
+
switch (bl->type) {
case BL_MOB:
case BL_PC:
clif->pActionRequest_sub(sd, 0x07, bl->id, iTimer->gettick());
break;
case BL_NPC:
+ if( sd->ud.skilltimer != INVALID_TIMER ) {
+ clif->colormes(fd,COLOR_WHITE,msg_txt(1476));
+ break;
+ }
if( bl->m != -1 )// the user can't click floating npcs directly (hack attempt)
npc_click(sd,(TBL_NPC*)bl);
break;
@@ -10872,7 +10874,7 @@ void clif_parse_CreateChatRoom(int fd, struct map_session_data* sd)
if (sd->sc.data[SC_NOCHAT] && sd->sc.data[SC_NOCHAT]->val1&MANNER_NOROOM)
return;
- if(battle_config.basic_skill_check && iPc->checkskill(sd,NV_BASIC) < 4) {
+ if(battle_config.basic_skill_check && pc->checkskill(sd,NV_BASIC) < 4) {
clif->skill_fail(sd,1,USESKILL_FAIL_LEVEL,3);
return;
}
@@ -10990,7 +10992,7 @@ void clif_parse_TradeRequest(int fd,struct map_session_data *sd)
return;
}
- if( battle_config.basic_skill_check && iPc->checkskill(sd,NV_BASIC) < 1) {
+ if( battle_config.basic_skill_check && pc->checkskill(sd,NV_BASIC) < 1) {
clif->skill_fail(sd,1,USESKILL_FAIL_LEVEL,0);
return;
}
@@ -11064,7 +11066,7 @@ void clif_parse_PutItemToCart(int fd,struct map_session_data *sd)
return;
if (!pc_iscarton(sd))
return;
- iPc->putitemtocart(sd,RFIFOW(fd,2)-2,RFIFOL(fd,4));
+ pc->putitemtocart(sd,RFIFOW(fd,2)-2,RFIFOL(fd,4));
}
@@ -11074,7 +11076,7 @@ void clif_parse_GetItemFromCart(int fd,struct map_session_data *sd)
{
if (!pc_iscarton(sd))
return;
- iPc->getitemfromcart(sd,RFIFOW(fd,2)-2,RFIFOL(fd,4));
+ pc->getitemfromcart(sd,RFIFOW(fd,2)-2,RFIFOL(fd,4));
}
@@ -11086,11 +11088,11 @@ void clif_parse_RemoveOption(int fd,struct map_session_data *sd)
* Attempts to remove these options when this function is called (will remove all available)
**/
#ifdef NEW_CARTS
- iPc->setoption(sd,sd->sc.option&~(OPTION_RIDING|OPTION_FALCON|OPTION_DRAGON|OPTION_MADOGEAR));
+ pc->setoption(sd,sd->sc.option&~(OPTION_RIDING|OPTION_FALCON|OPTION_DRAGON|OPTION_MADOGEAR));
if( sd->sc.data[SC_PUSH_CART] )
- iPc->setcart(sd,0);
+ pc->setcart(sd,0);
#else
- iPc->setoption(sd,sd->sc.option&~(OPTION_CART|OPTION_RIDING|OPTION_FALCON|OPTION_DRAGON|OPTION_MADOGEAR));
+ pc->setoption(sd,sd->sc.option&~(OPTION_CART|OPTION_RIDING|OPTION_FALCON|OPTION_DRAGON|OPTION_MADOGEAR));
#endif
}
@@ -11101,7 +11103,7 @@ void clif_parse_ChangeCart(int fd,struct map_session_data *sd)
{// TODO: State tracking?
int type;
- if( sd && iPc->checkskill(sd, MC_CHANGECART) < 1 )
+ if( sd && pc->checkskill(sd, MC_CHANGECART) < 1 )
return;
type = (int)RFIFOW(fd,2);
@@ -11122,7 +11124,7 @@ void clif_parse_ChangeCart(int fd,struct map_session_data *sd)
(type == 2 && sd->status.base_level > 40) ||
(type == 1))
#endif
- iPc->setcart(sd,type);
+ pc->setcart(sd,type);
}
@@ -11135,7 +11137,7 @@ void clif_parse_ChangeCart(int fd,struct map_session_data *sd)
/// the like
void clif_parse_StatusUp(int fd,struct map_session_data *sd)
{
- iPc->statusup(sd,RFIFOW(fd,2));
+ pc->statusup(sd,RFIFOW(fd,2));
}
@@ -11143,7 +11145,7 @@ void clif_parse_StatusUp(int fd,struct map_session_data *sd)
/// 0112 <skill id>.W
void clif_parse_SkillUp(int fd,struct map_session_data *sd)
{
- iPc->skillup(sd,RFIFOW(fd,2));
+ pc->skillup(sd,RFIFOW(fd,2));
}
void clif_parse_UseSkillToId_homun(struct homun_data *hd, struct map_session_data *sd, unsigned int tick, uint16 skill_id, uint16 skill_lv, int target_id)
@@ -11314,7 +11316,7 @@ void clif_parse_UseSkillToId(int fd, struct map_session_data *sd)
if( skill_lv != sd->skillitemlv )
skill_lv = sd->skillitemlv;
if( !(tmp&INF_SELF_SKILL) )
- iPc->delinvincibletimer(sd); // Target skills thru items cancel invincibility. [Inkfish]
+ pc->delinvincibletimer(sd); // Target skills thru items cancel invincibility. [Inkfish]
unit_skilluse_id(&sd->bl, target_id, skill_id, skill_lv);
return;
}
@@ -11327,12 +11329,12 @@ void clif_parse_UseSkillToId(int fd, struct map_session_data *sd)
else
skill_lv = 0;
} else {
- tmp = iPc->checkskill(sd, skill_id);
+ tmp = pc->checkskill(sd, skill_id);
if( skill_lv > tmp )
skill_lv = tmp;
}
- iPc->delinvincibletimer(sd);
+ pc->delinvincibletimer(sd);
if( skill_lv )
unit_skilluse_id(&sd->bl, target_id, skill_id, skill_lv);
@@ -11395,7 +11397,7 @@ void clif_parse_UseSkillToPosSub(int fd, struct map_session_data *sd, uint16 ski
return; //Can't use skills while a menu is open.
}
- iPc->delinvincibletimer(sd);
+ pc->delinvincibletimer(sd);
if( sd->skillitem == skill_id ) {
if( skill_lv != sd->skillitemlv )
@@ -11404,7 +11406,7 @@ void clif_parse_UseSkillToPosSub(int fd, struct map_session_data *sd, uint16 ski
} else {
int lv;
sd->skillitem = sd->skillitemlv = 0;
- if( (lv = iPc->checkskill(sd, skill_id)) > 0 ) {
+ if( (lv = pc->checkskill(sd, skill_id)) > 0 ) {
if( skill_lv > lv )
skill_lv = lv;
unit_skilluse_pos(&sd->bl, x, y, skill_id,skill_lv);
@@ -11471,7 +11473,7 @@ void clif_parse_UseSkillMap(int fd, struct map_session_data* sd)
return;
}
- iPc->delinvincibletimer(sd);
+ pc->delinvincibletimer(sd);
skill->castend_map(sd,skill_id,map_name);
}
@@ -11481,7 +11483,7 @@ void clif_parse_UseSkillMap(int fd, struct map_session_data* sd)
void clif_parse_RequestMemo(int fd,struct map_session_data *sd)
{
if (!pc_isdead(sd))
- iPc->memo(sd,-1);
+ pc->memo(sd,-1);
}
@@ -11729,7 +11731,7 @@ void clif_parse_InsertCard(int fd,struct map_session_data *sd)
{
if (sd->state.trading != 0)
return;
- iPc->insert_card(sd,RFIFOW(fd,2)-2,RFIFOW(fd,4)-2);
+ pc->insert_card(sd,RFIFOW(fd,2)-2,RFIFOW(fd,4)-2);
}
@@ -11933,12 +11935,12 @@ void clif_parse_CreateParty(int fd, struct map_session_data *sd)
clif->message(fd, msg_txt(227));
return;
}
- if( battle_config.basic_skill_check && iPc->checkskill(sd,NV_BASIC) < 7 ) {
+ if( battle_config.basic_skill_check && pc->checkskill(sd,NV_BASIC) < 7 ) {
clif->skill_fail(sd,1,USESKILL_FAIL_LEVEL,4);
return;
}
- iParty->create(sd,name,0,0);
+ party->create(sd,name,0,0);
}
void clif_parse_CreateParty2(int fd, struct map_session_data *sd)
@@ -11952,12 +11954,12 @@ void clif_parse_CreateParty2(int fd, struct map_session_data *sd)
clif->message(fd, msg_txt(227));
return;
}
- if( battle_config.basic_skill_check && iPc->checkskill(sd,NV_BASIC) < 7 ) {
+ if( battle_config.basic_skill_check && pc->checkskill(sd,NV_BASIC) < 7 ) {
clif->skill_fail(sd,1,USESKILL_FAIL_LEVEL,4);
return;
}
- iParty->create(sd,name,item1,item2);
+ party->create(sd,name,item1,item2);
}
@@ -11980,7 +11982,7 @@ void clif_parse_PartyInvite(int fd, struct map_session_data *sd)
return;
}
- iParty->invite(sd, t_sd);
+ party->invite(sd, t_sd);
}
void clif_parse_PartyInvite2(int fd, struct map_session_data *sd)
@@ -12001,7 +12003,7 @@ void clif_parse_PartyInvite2(int fd, struct map_session_data *sd)
return;
}
- iParty->invite(sd, t_sd);
+ party->invite(sd, t_sd);
}
@@ -12013,12 +12015,12 @@ void clif_parse_PartyInvite2(int fd, struct map_session_data *sd)
/// 1 = accept
void clif_parse_ReplyPartyInvite(int fd,struct map_session_data *sd)
{
- iParty->reply_invite(sd,RFIFOL(fd,2),RFIFOL(fd,6));
+ party->reply_invite(sd,RFIFOL(fd,2),RFIFOL(fd,6));
}
void clif_parse_ReplyPartyInvite2(int fd,struct map_session_data *sd)
{
- iParty->reply_invite(sd,RFIFOL(fd,2),RFIFOB(fd,6));
+ party->reply_invite(sd,RFIFOL(fd,2),RFIFOB(fd,6));
}
@@ -12030,7 +12032,7 @@ void clif_parse_LeaveParty(int fd, struct map_session_data *sd)
clif->message(fd, msg_txt(227));
return;
}
- iParty->leave(sd);
+ party->leave(sd);
}
@@ -12042,7 +12044,7 @@ void clif_parse_RemovePartyMember(int fd, struct map_session_data *sd)
clif->message(fd, msg_txt(227));
return;
}
- iParty->removemember(sd,RFIFOL(fd,2),(char*)RFIFOP(fd,6));
+ party->removemember(sd,RFIFOL(fd,2),(char*)RFIFOP(fd,6));
}
@@ -12057,7 +12059,7 @@ void clif_parse_PartyChangeOption(int fd, struct map_session_data *sd)
if( !sd->status.party_id )
return;
- p = iParty->search(sd->status.party_id);
+ p = party->search(sd->status.party_id);
if( p == NULL )
return;
@@ -12070,9 +12072,9 @@ void clif_parse_PartyChangeOption(int fd, struct map_session_data *sd)
#if PACKETVER < 20090603
//Client can't change the item-field
- iParty->changeoption(sd, RFIFOL(fd,2), p->party.item);
+ party->changeoption(sd, RFIFOL(fd,2), p->party.item);
#else
- iParty->changeoption(sd, RFIFOL(fd,2), ((RFIFOB(fd,6)?1:0)|(RFIFOB(fd,7)?2:0)));
+ party->changeoption(sd, RFIFOL(fd,2), ((RFIFOB(fd,6)?1:0)|(RFIFOB(fd,7)?2:0)));
#endif
}
@@ -12094,7 +12096,7 @@ void clif_parse_PartyMessage(int fd, struct map_session_data* sd)
if( atcommand->parse(fd, sd, message, 1) )
return;
- if( sd->sc.data[SC_BERSERK] || sd->sc.data[SC__BLOODYLUST] || (sd->sc.data[SC_NOCHAT] && sd->sc.data[SC_NOCHAT]->val1&MANNER_NOCHAT) )
+ if( sd->sc.data[SC_BERSERK] || sd->sc.data[SC_DEEPSLEEP] || sd->sc.data[SC__BLOODYLUST] || (sd->sc.data[SC_NOCHAT] && sd->sc.data[SC_NOCHAT]->val1&MANNER_NOCHAT) )
return;
if( battle_config.min_chat_delay )
@@ -12104,7 +12106,7 @@ void clif_parse_PartyMessage(int fd, struct map_session_data* sd)
sd->cantalk_tick = iTimer->gettick() + battle_config.min_chat_delay;
}
- iParty->send_message(sd, text, textlen);
+ party->send_message(sd, text, textlen);
}
@@ -12112,10 +12114,10 @@ void clif_parse_PartyMessage(int fd, struct map_session_data* sd)
/// 07da <account id>.L
void clif_parse_PartyChangeLeader(int fd, struct map_session_data* sd)
{
- iParty->changeleader(sd, iMap->id2sd(RFIFOL(fd,2)));
+ party->changeleader(sd, iMap->id2sd(RFIFOL(fd,2)));
}
-
+#ifndef PARTY_RECRUIT
/// Party Booking in KRO [Spiria]
///
@@ -12131,7 +12133,7 @@ void clif_parse_PartyBookingRegisterReq(int fd, struct map_session_data* sd)
for(i=0; i<PARTY_BOOKING_JOBS; i++)
job[i] = RFIFOB(fd,6+i*2);
- iParty->booking_register(sd, level, mapid, job);
+ party->booking_register(sd, level, mapid, job);
}
@@ -12162,7 +12164,7 @@ void clif_parse_PartyBookingSearchReq(int fd, struct map_session_data* sd)
unsigned long lastindex = RFIFOL(fd,8);
short resultcount = RFIFOW(fd,12);
- iParty->booking_search(sd, level, mapid, job, lastindex, resultcount);
+ party->booking_search(sd, level, mapid, job, lastindex, resultcount);
}
@@ -12185,7 +12187,7 @@ void clif_PartyBookingSearchAck(int fd, struct party_booking_ad_info** results,
pb_ad = results[i];
WFIFOL(fd,i*size+5) = pb_ad->index;
memcpy(WFIFOP(fd,i*size+9),pb_ad->charname,NAME_LENGTH);
- WFIFOL(fd,i*size+33) = pb_ad->starttime; // FIXME: This is expire time
+ WFIFOL(fd,i*size+33) = pb_ad->expiretime;
WFIFOW(fd,i*size+37) = pb_ad->p_detail.level;
WFIFOW(fd,i*size+39) = pb_ad->p_detail.mapid;
for(j=0; j<PARTY_BOOKING_JOBS; j++)
@@ -12199,7 +12201,7 @@ void clif_PartyBookingSearchAck(int fd, struct party_booking_ad_info** results,
/// 0806
void clif_parse_PartyBookingDeleteReq(int fd, struct map_session_data* sd)
{
- if(iParty->booking_delete(sd))
+ if(party->booking_delete(sd))
clif->PartyBookingDeleteAck(sd, 0);
}
@@ -12232,7 +12234,7 @@ void clif_parse_PartyBookingUpdateReq(int fd, struct map_session_data* sd)
for(i=0; i<PARTY_BOOKING_JOBS; i++)
job[i] = RFIFOW(fd,2+i*2);
- iParty->booking_update(sd, job);
+ party->booking_update(sd, job);
}
@@ -12248,7 +12250,7 @@ void clif_PartyBookingInsertNotify(struct map_session_data* sd, struct party_boo
WBUFW(buf,0) = 0x809;
WBUFL(buf,2) = pb_ad->index;
memcpy(WBUFP(buf,6),pb_ad->charname,NAME_LENGTH);
- WBUFL(buf,30) = pb_ad->starttime; // FIXME: This is expire time
+ WBUFL(buf,30) = pb_ad->expiretime;
WBUFW(buf,34) = pb_ad->p_detail.level;
WBUFW(buf,36) = pb_ad->p_detail.mapid;
for(i=0; i<PARTY_BOOKING_JOBS; i++)
@@ -12287,6 +12289,310 @@ void clif_PartyBookingDeleteNotify(struct map_session_data* sd, int index)
clif->send(buf, packet_len(0x80b), &sd->bl, ALL_CLIENT); // Now UPDATE all client.
}
+#else
+/// Modified version of Party Booking System for 2012-04-10 or 2012-04-18 (RagexeRE).
+/// Code written by mkbu95, Spiria, Yommy and Ind
+
+/// Request to register a party booking advertisment (CZ_PARTY_RECRUIT_REQ_REGISTER).
+/// 08e5 <level>.W <notice>.37B
+void clif_parse_PartyBookingRegisterReq(int fd, struct map_session_data* sd)
+{
+ short level = RFIFOW(fd,2);
+ const char *notice = (const char*)RFIFOP(fd, 4);
+
+ party->booking_register(sd, level, notice);
+}
+
+/// Party booking search results (ZC_PARTY_RECRUIT_ACK_SEARCH).
+/// 08e8 <packet len>.W <more results>.B { <index>.L <char name>.24B <expire time>.L <level>.W <notice>.37B }*
+/// more results:
+/// 0 = no
+/// 1 = yes
+void clif_PartyBookingSearchAck(int fd, struct party_booking_ad_info** results, int count, bool more_result)
+{
+ int i;
+ int size = sizeof(struct party_booking_ad_info);
+ struct party_booking_ad_info *pb_ad;
+
+ WFIFOHEAD(fd, (size * count) + 5);
+ WFIFOW(fd, 0) = 0x8e8;
+ WFIFOW(fd, 2) = (size * count) + 5;
+ WFIFOB(fd, 4) = more_result;
+
+ for (i = 0; i < count; ++i) {
+ pb_ad = results[i];
+
+ WFIFOL(fd, (i * size) + 5) = pb_ad->index;
+ WFIFOL(fd, (i * size) + 9) = pb_ad->expiretime;
+ memcpy(WFIFOP(fd, (i * size) + 13), pb_ad->charname, NAME_LENGTH);
+ WFIFOW(fd, (i * size) + 13 + NAME_LENGTH) = pb_ad->p_detail.level;
+ memcpy(WFIFOP(fd, (i * size) + 13 + NAME_LENGTH + 2), pb_ad->p_detail.notice, PB_NOTICE_LENGTH);
+ }
+
+ WFIFOSET(fd,WFIFOW(fd,2));
+}
+
+/// Result of request to register a party booking advertisment (ZC_PARTY_RECRUIT_ACK_REGISTER).
+/// 08e6 <result>.W
+/// result:
+/// 0 = success
+/// 1 = failure
+/// 2 = already registered
+void clif_PartyBookingRegisterAck(struct map_session_data *sd, int flag)
+{
+ int fd = sd->fd;
+
+ WFIFOHEAD(fd, packet_len(0x8e6));
+ WFIFOW(fd, 0) = 0x8e6;
+ WFIFOW(fd, 2) = flag;
+ WFIFOSET(fd, packet_len(0x8e6));
+}
+
+/// Request to search for party booking advertisments (CZ_PARTY_RECRUIT_REQ_SEARCH).
+/// 08e7 <level>.W <map id>.W <last index>.L <result count>.W
+void clif_parse_PartyBookingSearchReq(int fd, struct map_session_data* sd)
+{
+ short level = RFIFOW(fd, 2);
+ short mapid = RFIFOW(fd, 4);
+ unsigned long lastindex = RFIFOL(fd, 6);
+ short resultcount = RFIFOW(fd, 10);
+
+ party->booking_search(sd, level, mapid, lastindex, resultcount);
+}
+
+/// Request to delete own party booking advertisment (CZ_PARTY_RECRUIT_REQ_DELETE).
+/// 08e9
+void clif_parse_PartyBookingDeleteReq(int fd, struct map_session_data* sd)
+{
+ if(party->booking_delete(sd))
+ clif->PartyBookingDeleteAck(sd, 0);
+}
+
+/// Result of request to delete own party booking advertisment (ZC_PARTY_RECRUIT_ACK_DELETE).
+/// 08ea <result>.W
+/// result:
+/// 0 = success
+/// 1 = success (auto-removed expired ad)
+/// 2 = failure
+/// 3 = nothing registered
+void clif_PartyBookingDeleteAck(struct map_session_data* sd, int flag)
+{
+ int fd = sd->fd;
+
+ WFIFOHEAD(fd, packet_len(0x8ea));
+ WFIFOW(fd, 0) = 0x8ea;
+ WFIFOW(fd, 2) = flag;
+ WFIFOSET(fd, packet_len(0x8ea));
+}
+
+/// Request to update party booking advertisment (CZ_PARTY_RECRUIT_REQ_UPDATE).
+/// 08eb <notice>.37B
+void clif_parse_PartyBookingUpdateReq(int fd, struct map_session_data *sd)
+{
+ const char *notice;
+
+ notice = (const char*)RFIFOP(fd, 2);
+
+ party->booking_update(sd, notice);
+}
+
+/// Notification about new party booking advertisment (ZC_PARTY_RECRUIT_NOTIFY_INSERT).
+/// 08ec <index>.L <expire time>.L <char name>.24B <level>.W <notice>.37B
+void clif_PartyBookingInsertNotify(struct map_session_data* sd, struct party_booking_ad_info* pb_ad)
+{
+ unsigned char buf[2+6+6+24+4+37+1];
+
+ if (pb_ad == NULL)
+ return;
+
+ WBUFW(buf, 0) = 0x8ec;
+ WBUFL(buf, 2) = pb_ad->index;
+ WBUFL(buf, 6) = pb_ad->expiretime;
+ memcpy(WBUFP(buf, 10), pb_ad->charname, NAME_LENGTH);
+ WBUFW(buf,34) = pb_ad->p_detail.level;
+ memcpy(WBUFP(buf, 36), pb_ad->p_detail.notice, PB_NOTICE_LENGTH);
+ clif->send(buf, packet_len(0x8ec), &sd->bl, ALL_CLIENT);
+}
+
+/// Notification about updated party booking advertisment (ZC_PARTY_RECRUIT_NOTIFY_UPDATE).
+/// 08ed <index>.L <notice>.37B
+void clif_PartyBookingUpdateNotify(struct map_session_data *sd, struct party_booking_ad_info* pb_ad)
+{
+ unsigned char buf[2+6+37+1];
+
+ WBUFW(buf, 0) = 0x8ed;
+ WBUFL(buf, 2) = pb_ad->index;
+ memcpy(WBUFP(buf, 6), pb_ad->p_detail.notice, PB_NOTICE_LENGTH);
+
+ clif->send(buf, packet_len(0x8ed), &sd->bl, ALL_CLIENT);
+}
+
+/// Notification about deleted party booking advertisment (ZC_PARTY_RECRUIT_NOTIFY_DELETE).
+/// 08ee <index>.L
+void clif_PartyBookingDeleteNotify(struct map_session_data* sd, int index)
+{
+ unsigned char buf[2+6+1];
+
+ WBUFW(buf, 0) = 0x8ee;
+ WBUFL(buf, 2) = index;
+
+ clif->send(buf, packet_len(0x8ee), &sd->bl, ALL_CLIENT);
+}
+
+/// Request to add to filtering list (PARTY_RECRUIT_ADD_FILTERLINGLIST).
+/// 08ef <index>.L
+void clif_parse_PartyBookingAddFilteringList(int fd, struct map_session_data *sd)
+{
+ int index = RFIFOL(fd, 2);
+
+ clif->PartyBookingAddFilteringList(index, sd);
+}
+
+/// Request to remove from filtering list (PARTY_RECRUIT_SUB_FILTERLINGLIST).
+/// 08f0 <GID>.L
+void clif_parse_PartyBookingSubFilteringList(int fd, struct map_session_data *sd)
+{
+ int gid = RFIFOL(fd, 2);
+
+ clif->PartyBookingSubFilteringList(gid, sd);
+}
+
+/// Request to recruit volunteer (PARTY_RECRUIT_REQ_VOLUNTEER).
+/// 08f1 <index>.L
+void clif_parse_PartyBookingReqVolunteer(int fd, struct map_session_data *sd)
+{
+ int index = RFIFOL(fd, 2);
+
+ clif->PartyBookingVolunteerInfo(index, sd);
+}
+
+/// Request volunteer information (PARTY_RECRUIT_VOLUNTEER_INFO).
+/// 08f2 <AID>.L <job>.L <level>.W <char name>.24B
+void clif_PartyBookingVolunteerInfo(int index, struct map_session_data *sd)
+{
+ unsigned char buf[2+4+4+2+24+1];
+
+ WBUFW(buf, 0) = 0x8f2;
+ WBUFL(buf, 2) = sd->status.account_id;
+ WBUFL(buf, 6) = sd->status.class_;
+ WBUFW(buf, 10) = sd->status.base_level;
+ memcpy(WBUFP(buf, 12), sd->status.name, NAME_LENGTH);
+
+ clif->send(buf, packet_len(0x8f2), &sd->bl, ALL_CLIENT);
+}
+
+#if 0 //Disabled for now. Needs more info.
+/// 08f3 <packet type>.W <cost>.L
+void clif_PartyBookingPersonalSetting(int fd, struct map_session_data *sd)
+{
+}
+
+/// 08f4 <target GID>.L
+void clif_parse_PartyBookingShowEquipment(int fd, struct map_session_data *sd)
+{
+}
+
+/// 08f5 <packet len>.W
+void clif_parse_PartyBookingReqRecall(int fd, struct map_session_data *sd)
+{
+}
+
+/// 08f6 <money>.L <map name>.16B
+void clif_PartyBookingRecallCost(int fd, struct map_session_data *sd)
+{
+}
+
+/// 08f7 <result>.B
+void clif_parse_PartyBookingAckRecall(int fd, struct map_session_data *sd)
+{
+}
+
+/// 08f8 <caller AID>.L <reason>.B
+/// <reason>:
+/// REASON_PROHIBITION = 0x0
+/// REASON_MASTER_IN_PROHIBITION_MAP = 0x1
+/// REASON_REFUSE = 0x2
+/// REASON_NOT_PARTY_MEMBER = 0x3
+/// REASON_ETC = 0x4
+void clif_PartyBookingFailedRecall(int fd, struct map_session_data *sd)
+{
+}
+#endif //if 0
+
+/// 08f9 <refuse AID>.L
+void clif_parse_PartyBookingRefuseVolunteer(int fd, struct map_session_data *sd)
+{
+ unsigned long aid = RFIFOL(fd, 2);
+
+ clif->PartyBookingRefuseVolunteer(aid, sd);
+}
+
+/// 08fa <index>.L
+void clif_PartyBookingRefuseVolunteer(unsigned long aid, struct map_session_data *sd)
+{
+ unsigned char buf[2+6];
+
+ WBUFW(buf, 0) = 0x8fa;
+ WBUFL(buf, 2) = aid;
+
+ clif->send(buf, packet_len(0x8fa), &sd->bl, ALL_CLIENT);
+}
+
+/// 08fb <index>.L
+void clif_parse_PartyBookingCancelVolunteer(int fd, struct map_session_data *sd)
+{
+ int index = RFIFOL(fd, 2);
+
+ clif->PartyBookingCancelVolunteer(index, sd);
+}
+
+/// 0909 <index>.L
+void clif_PartyBookingCancelVolunteer(int index, struct map_session_data *sd)
+{
+ unsigned char buf[2+6+1];
+
+ WBUFW(buf, 0) = 0x909;
+ WBUFL(buf, 2) = index;
+
+ clif->send(buf, packet_len(0x909), &sd->bl, ALL_CLIENT);
+}
+
+/// 090b <gid>.L <char name>.24B
+void clif_PartyBookingAddFilteringList(int index, struct map_session_data *sd)
+{
+ unsigned char buf[2+6+24+1];
+
+ WBUFW(buf, 0) = 0x90b;
+ WBUFL(buf, 2) = sd->bl.id;
+ memcpy(WBUFP(buf, 6), sd->status.name, NAME_LENGTH);
+
+ clif->send(buf, packet_len(0x90b), &sd->bl, ALL_CLIENT);
+}
+
+/// 090c <gid>.L <char name>.24B
+void clif_PartyBookingSubFilteringList(int gid, struct map_session_data *sd)
+{
+ unsigned char buf[2+6+24+1];
+
+ WBUFW(buf, 0) = 0x90c;
+ WBUFL(buf, 2) = gid;
+ memcpy(WBUFP(buf, 6), sd->status.name, NAME_LENGTH);
+
+ clif->send(buf, packet_len(0x90c), &sd->bl, ALL_CLIENT);
+}
+
+#if 0
+/// 091c <aid>.L
+void clif_PartyBookingCancelVolunteerToPM(struct map_session_data *sd)
+{
+}
+
+/// 0971 <pm_aid>.L
+void clif_PartyBookingRefuseVolunteerToPM(struct map_session_data *sd)
+{
+}
+#endif //if 0
+#endif
/// Request to close own vending (CZ_REQ_CLOSESTORE).
/// 012e
@@ -12631,7 +12937,7 @@ void clif_parse_GuildMessage(int fd, struct map_session_data* sd)
if( atcommand->parse(fd, sd, message, 1) )
return;
- if( sd->sc.data[SC_BERSERK] || sd->sc.data[SC__BLOODYLUST] || (sd->sc.data[SC_NOCHAT] && sd->sc.data[SC_NOCHAT]->val1&MANNER_NOCHAT) )
+ if( sd->sc.data[SC_BERSERK] || sd->sc.data[SC_DEEPSLEEP] || sd->sc.data[SC__BLOODYLUST] || (sd->sc.data[SC_NOCHAT] && sd->sc.data[SC_NOCHAT]->val1&MANNER_NOCHAT) )
return;
if( battle_config.min_chat_delay )
@@ -12853,7 +13159,7 @@ void clif_parse_GMKick(int fd, struct map_session_data *sd)
case BL_MOB:
{
char command[100];
- if( !iPc->can_use_command(sd, "@killmonster")) {
+ if( !pc->can_use_command(sd, "@killmonster")) {
clif->GM_kickack(sd, 0);
return;
}
@@ -13024,7 +13330,7 @@ void clif_parse_GMReqNoChat(int fd,struct map_session_data *sd)
//If type is 2 and the ids don't match, this is a crafted hacked packet!
//Disabled because clients keep self-muting when you give players public @ commands... [Skotlex]
- if (type == 2 /* && (iPc->get_group_level(sd) > 0 || sd->bl.id != id)*/)
+ if (type == 2 /* && (pc->get_group_level(sd) > 0 || sd->bl.id != id)*/)
return;
dstsd = iMap->id2sd(id);
@@ -13241,8 +13547,8 @@ void clif_parse_NoviceDoriDori(int fd, struct map_session_data *sd)
void clif_parse_NoviceExplosionSpirits(int fd, struct map_session_data *sd)
{
if( ( sd->class_&MAPID_UPPERMASK ) == MAPID_SUPER_NOVICE ) {
- unsigned int next = iPc->nextbaseexp(sd);
- if( next == 0 ) next = iPc->thisbaseexp(sd);
+ unsigned int next = pc->nextbaseexp(sd);
+ if( next == 0 ) next = pc->thisbaseexp(sd);
if( next ) {
int percent = (int)( ( (float)sd->status.base_exp/(float)next )*1000. );
@@ -13882,7 +14188,7 @@ void clif_parse_HomMenu(int fd, struct map_session_data *sd) { //[orn]
/// 0292
void clif_parse_AutoRevive(int fd, struct map_session_data *sd)
{
- int item_position = iPc->search_inventory(sd, ITEMID_TOKEN_OF_SIEGFRIED);
+ int item_position = pc->search_inventory(sd, ITEMID_TOKEN_OF_SIEGFRIED);
if (item_position < 0)
return;
@@ -13894,7 +14200,7 @@ void clif_parse_AutoRevive(int fd, struct map_session_data *sd)
return;
clif->skill_nodamage(&sd->bl,&sd->bl,ALL_RESURRECTION,4,1);
- iPc->delitem(sd, item_position, 1, 0, 1, LOG_TYPE_CONSUME);
+ pc->delitem(sd, item_position, 1, 0, 1, LOG_TYPE_CONSUME);
}
@@ -13909,17 +14215,17 @@ void clif_check(int fd, struct map_session_data* pl_sd) {
WFIFOHEAD(fd,packet_len(0x214));
WFIFOW(fd, 0) = 0x214;
WFIFOB(fd, 2) = min(pl_sd->status.str, UINT8_MAX);
- WFIFOB(fd, 3) = iPc->need_status_point(pl_sd, SP_STR, 1);
+ WFIFOB(fd, 3) = pc->need_status_point(pl_sd, SP_STR, 1);
WFIFOB(fd, 4) = min(pl_sd->status.agi, UINT8_MAX);
- WFIFOB(fd, 5) = iPc->need_status_point(pl_sd, SP_AGI, 1);
+ WFIFOB(fd, 5) = pc->need_status_point(pl_sd, SP_AGI, 1);
WFIFOB(fd, 6) = min(pl_sd->status.vit, UINT8_MAX);
- WFIFOB(fd, 7) = iPc->need_status_point(pl_sd, SP_VIT, 1);
+ WFIFOB(fd, 7) = pc->need_status_point(pl_sd, SP_VIT, 1);
WFIFOB(fd, 8) = min(pl_sd->status.int_, UINT8_MAX);
- WFIFOB(fd, 9) = iPc->need_status_point(pl_sd, SP_INT, 1);
+ WFIFOB(fd, 9) = pc->need_status_point(pl_sd, SP_INT, 1);
WFIFOB(fd,10) = min(pl_sd->status.dex, UINT8_MAX);
- WFIFOB(fd,11) = iPc->need_status_point(pl_sd, SP_DEX, 1);
+ WFIFOB(fd,11) = pc->need_status_point(pl_sd, SP_DEX, 1);
WFIFOB(fd,12) = min(pl_sd->status.luk, UINT8_MAX);
- WFIFOB(fd,13) = iPc->need_status_point(pl_sd, SP_LUK, 1);
+ WFIFOB(fd,13) = pc->need_status_point(pl_sd, SP_LUK, 1);
WFIFOW(fd,14) = pl_sd->battle_status.batk+pl_sd->battle_status.rhw.atk+pl_sd->battle_status.lhw.atk;
WFIFOW(fd,16) = pl_sd->battle_status.rhw.atk2+pl_sd->battle_status.lhw.atk2;
WFIFOW(fd,18) = pl_sd->battle_status.matk_max;
@@ -13951,7 +14257,7 @@ void clif_parse_Check(int fd, struct map_session_data *sd)
safestrncpy(charname, (const char*)RFIFOP(fd,packet_db[RFIFOW(fd,0)].pos[0]), sizeof(charname));
- if( ( pl_sd = iMap->nick2sd(charname) ) == NULL || iPc->get_group_level(sd) < iPc->get_group_level(pl_sd) ) {
+ if( ( pl_sd = iMap->nick2sd(charname) ) == NULL || pc->get_group_level(sd) < pc->get_group_level(pl_sd) ) {
return;
}
@@ -14233,9 +14539,9 @@ void clif_parse_Mail_getattach(int fd, struct map_session_data *sd)
if ((data = itemdb_exists(sd->mail.inbox.msg[i].item.nameid)) == NULL)
return;
- switch( iPc->checkadditem(sd, data->nameid, sd->mail.inbox.msg[i].item.amount) ) {
+ switch( pc->checkadditem(sd, data->nameid, sd->mail.inbox.msg[i].item.amount) ) {
case ADDITEM_NEW:
- fail = ( iPc->inventoryblank(sd) == 0 );
+ fail = ( pc->inventoryblank(sd) == 0 );
break;
case ADDITEM_OVERAMOUNT:
fail = true;
@@ -14527,9 +14833,9 @@ void clif_parse_Auction_setitem(int fd, struct map_session_data *sd)
return;
}
- if( !iPc->can_give_items(sd) || sd->status.inventory[idx].expire_time ||
+ if( !pc->can_give_items(sd) || sd->status.inventory[idx].expire_time ||
!sd->status.inventory[idx].identify ||
- !itemdb_canauction(&sd->status.inventory[idx],iPc->get_group_level(sd)) ) { // Quest Item or something else
+ !itemdb_canauction(&sd->status.inventory[idx],pc->get_group_level(sd)) ) { // Quest Item or something else
clif->auction_setitem(sd->fd, idx, true);
return;
}
@@ -14646,10 +14952,10 @@ void clif_parse_Auction_register(int fd, struct map_session_data *sd)
{
int zeny = auction.hours*battle_config.auction_feeperhour;
- iPc->delitem(sd, sd->auction.index, sd->auction.amount, 1, 6, LOG_TYPE_AUCTION);
+ pc->delitem(sd, sd->auction.index, sd->auction.amount, 1, 6, LOG_TYPE_AUCTION);
sd->auction.amount = 0;
- iPc->payzeny(sd, zeny, LOG_TYPE_AUCTION, NULL);
+ pc->payzeny(sd, zeny, LOG_TYPE_AUCTION, NULL);
}
}
@@ -14681,7 +14987,7 @@ void clif_parse_Auction_bid(int fd, struct map_session_data *sd)
unsigned int auction_id = RFIFOL(fd,2);
int bid = RFIFOL(fd,6);
- if( !iPc->can_give_items(sd) ) { //They aren't supposed to give zeny [Inkfish]
+ if( !pc->can_give_items(sd) ) { //They aren't supposed to give zeny [Inkfish]
clif->message(sd->fd, msg_txt(246));
return;
}
@@ -14693,7 +14999,7 @@ void clif_parse_Auction_bid(int fd, struct map_session_data *sd)
else if ( CheckForCharServer() ) // char server is down (bugreport:1138)
clif->auction_message(fd, 0); // You have failed to bid into the auction
else {
- iPc->payzeny(sd, bid, LOG_TYPE_AUCTION, NULL);
+ pc->payzeny(sd, bid, LOG_TYPE_AUCTION, NULL);
intif_Auction_bid(sd->status.char_id, sd->status.name, auction_id, bid);
}
}
@@ -14880,7 +15186,7 @@ void clif_parse_Adopt_request(int fd, struct map_session_data *sd)
{
struct map_session_data *tsd = iMap->id2sd(RFIFOL(fd,2)), *p_sd = iMap->charid2sd(sd->status.partner_id);
- if( iPc->can_Adopt(sd, p_sd, tsd) ) {
+ if( pc->can_Adopt(sd, p_sd, tsd) ) {
tsd->adopt_invite = sd->status.account_id;
clif->adopt_request(tsd, sd, p_sd->status.account_id);
}
@@ -14912,7 +15218,7 @@ void clif_parse_Adopt_reply(int fd, struct map_session_data *sd)
if( result == 0 )
return; // Rejected
- iPc->adoption(p1_sd, p2_sd, sd);
+ pc->adoption(p1_sd, p2_sd, sd);
}
@@ -15484,7 +15790,7 @@ void clif_parse_BattleChat(int fd, struct map_session_data* sd)
if( atcommand->parse(fd, sd, message, 1) )
return;
- if( sd->sc.data[SC_BERSERK] || sd->sc.data[SC__BLOODYLUST] || (sd->sc.data[SC_NOCHAT] && sd->sc.data[SC_NOCHAT]->val1&MANNER_NOCHAT) )
+ if( sd->sc.data[SC_BERSERK] || sd->sc.data[SC_DEEPSLEEP] || sd->sc.data[SC__BLOODYLUST] || (sd->sc.data[SC_NOCHAT] && sd->sc.data[SC_NOCHAT]->val1&MANNER_NOCHAT) )
return;
if( battle_config.min_chat_delay ) {
@@ -15586,7 +15892,7 @@ int clif_instance(int instance_id, int type, int flag) {
break;
case IOT_PARTY:
/* default is already PARTY */
- sd = iParty->getavailablesd(iParty->search(instances[instance_id].owner_id));
+ sd = party->getavailablesd(party->search(instances[instance_id].owner_id));
break;
case IOT_CHAR:
target = SELF;
@@ -16836,14 +17142,14 @@ void clif_parse_CashShopBuy(int fd, struct map_session_data *sd) {
if (!itemdb_isstackable2(data))
get_count = 1;
- iPc->paycash(sd, clif->cs.data[tab][j]->price * qty, kafra_pay);// [Ryuuzaki]
+ pc->paycash(sd, clif->cs.data[tab][j]->price * qty, kafra_pay);// [Ryuuzaki]
for (k = 0; k < qty; k += get_count) {
if (!pet_create_egg(sd, data->nameid)) {
memset(&item_tmp, 0, sizeof(item_tmp));
item_tmp.nameid = data->nameid;
item_tmp.identify = 1;
- switch (iPc->additem(sd, &item_tmp, get_count, LOG_TYPE_NPC)) {
+ switch (pc->additem(sd, &item_tmp, get_count, LOG_TYPE_NPC)) {
case 0:
result = CSBR_SUCCESS;
break;
@@ -16865,7 +17171,7 @@ void clif_parse_CashShopBuy(int fd, struct map_session_data *sd) {
}
if( result != CSBR_SUCCESS )
- iPc->getcash(sd, clif->cs.data[tab][j]->price * get_count,0);
+ pc->getcash(sd, clif->cs.data[tab][j]->price * get_count,0);
}
}
}
@@ -17131,6 +17437,7 @@ int clif_parse(int fd) {
return 0;
cmd = RFIFOW(fd,0);
+
// filter out invalid / unsupported packets
if (cmd > MAX_PACKET_DB || packet_db[cmd].len == 0) {
ShowWarning("clif_parse: Received unsupported packet (packet 0x%04x, %d bytes received), disconnecting session #%d.\n", cmd, RFIFOREST(fd), fd);
@@ -17478,7 +17785,7 @@ void clif_defaults(void) {
clif->equiptickack = clif_equiptickack;
clif->viewequip_ack = clif_viewequip_ack;
clif->viewequip_fail = clif_viewequip_fail;
- clif->equipcheckbox = clif_equipcheckbox;
+ clif->equpcheckbox = clif_equpcheckbox;
clif->displayexp = clif_displayexp;
clif->font = clif_font;
clif->progressbar = clif_progressbar;
@@ -17733,6 +18040,14 @@ void clif_defaults(void) {
clif->PartyBookingUpdateNotify = clif_PartyBookingUpdateNotify;
clif->PartyBookingDeleteNotify = clif_PartyBookingDeleteNotify;
clif->PartyBookingInsertNotify = clif_PartyBookingInsertNotify;
+ /* Group Search System Update */
+#ifdef PARTY_RECRUIT
+ clif->PartyBookingVolunteerInfo = clif_PartyBookingVolunteerInfo;
+ clif->PartyBookingRefuseVolunteer = clif_PartyBookingRefuseVolunteer;
+ clif->PartyBookingCancelVolunteer = clif_PartyBookingCancelVolunteer;
+ clif->PartyBookingAddFilteringList = clif_PartyBookingAddFilteringList;
+ clif->PartyBookingSubFilteringList = clif_PartyBookingSubFilteringList;
+#endif
/* buying store-related */
clif->buyingstore_open = clif_buyingstore_open;
clif->buyingstore_open_failed = clif_buyingstore_open_failed;
@@ -17994,6 +18309,14 @@ void clif_defaults(void) {
/* */
clif->pPartyTick = clif_parse_PartyTick;
clif->pGuildInvite2 = clif_parse_GuildInvite2;
+ /* Group Search System Update */
+#ifdef PARTY_RECRUIT
+ clif->pPartyBookingAddFilter = clif_parse_PartyBookingAddFilteringList;
+ clif->pPartyBookingSubFilter = clif_parse_PartyBookingSubFilteringList;
+ clif->pPartyBookingReqVolunteer = clif_parse_PartyBookingReqVolunteer;
+ clif->pPartyBookingRefuseVolunteer = clif_parse_PartyBookingRefuseVolunteer;
+ clif->pPartyBookingCancelVolunteer = clif_parse_PartyBookingCancelVolunteer;
+#endif
/* dull */
clif->pDull = clif_parse_dull;
}
diff --git a/src/map/clif.h b/src/map/clif.h
index a0959f92a..5393ef5b7 100644
--- a/src/map/clif.h
+++ b/src/map/clif.h
@@ -612,7 +612,7 @@ struct clif_interface {
void (*equiptickack) (struct map_session_data* sd, int flag);
void (*viewequip_ack) (struct map_session_data* sd, struct map_session_data* tsd);
void (*viewequip_fail) (struct map_session_data* sd);
- void (*equipcheckbox) (struct map_session_data* sd);
+ void (*equpcheckbox) (struct map_session_data* sd);
void (*displayexp) (struct map_session_data *sd, unsigned int exp, char type, bool quest);
void (*font) (struct map_session_data *sd);
void (*progressbar) (struct map_session_data * sd, unsigned long color, unsigned int second);
@@ -867,6 +867,14 @@ struct clif_interface {
void (*PartyBookingUpdateNotify) (struct map_session_data* sd, struct party_booking_ad_info* pb_ad);
void (*PartyBookingDeleteNotify) (struct map_session_data* sd, int index);
void (*PartyBookingInsertNotify) (struct map_session_data* sd, struct party_booking_ad_info* pb_ad);
+ /* Group Search System Update */
+#ifdef PARTY_RECRUIT
+ void (*PartyBookingVolunteerInfo) (int index, struct map_session_data *sd);
+ void (*PartyBookingRefuseVolunteer) (unsigned long aid, struct map_session_data *sd);
+ void (*PartyBookingCancelVolunteer) (int index, struct map_session_data *sd);
+ void (*PartyBookingAddFilteringList) (int index, struct map_session_data *sd);
+ void (*PartyBookingSubFilteringList) (int gid, struct map_session_data *sd);
+#endif
/* buying store-related */
void (*buyingstore_open) (struct map_session_data* sd);
void (*buyingstore_open_failed) (struct map_session_data* sd, unsigned short result, unsigned int weight);
@@ -1126,6 +1134,14 @@ struct clif_interface {
void (*pCashShopBuy) (int fd, struct map_session_data *sd);
void (*pPartyTick) (int fd, struct map_session_data *sd);
void (*pGuildInvite2) (int fd, struct map_session_data *sd);
+ /* Group Search System Update */
+#ifdef PARTY_RECRUIT
+ void (*pPartyBookingAddFilter) (int fd, struct map_session_data *sd);
+ void (*pPartyBookingSubFilter) (int fd, struct map_session_data *sd);
+ void (*pPartyBookingReqVolunteer) (int fd, struct map_session_data *sd);
+ void (*pPartyBookingRefuseVolunteer) (int fd, struct map_session_data *sd);
+ void (*pPartyBookingCancelVolunteer) (int fd, struct map_session_data *sd);
+#endif
} clif_s;
struct clif_interface *clif;
diff --git a/src/map/elemental.c b/src/map/elemental.c
index 17c6fe16d..53c85577b 100644
--- a/src/map/elemental.c
+++ b/src/map/elemental.c
@@ -126,7 +126,7 @@ int elemental_create(struct map_session_data *sd, int class_, unsigned int lifet
break;
}
- if( (i=iPc->checkskill(sd,SO_EL_SYMPATHY)) > 0 ){
+ if( (i=pc->checkskill(sd,SO_EL_SYMPATHY)) > 0 ){
ele.hp = ele.max_hp = ele.max_hp * 5 * i / 100;
ele.sp = ele.max_sp = ele.max_sp * 5 * i / 100;
ele.atk += 25 * i;
diff --git a/src/map/guild.c b/src/map/guild.c
index fe801462f..b28c14db7 100644
--- a/src/map/guild.c
+++ b/src/map/guild.c
@@ -297,7 +297,7 @@ int guild_payexp_timer_sub(DBKey key, DBData *data, va_list ap) {
struct guild_expcache *c;
struct guild *g;
- c = iDB->data2ptr(data);
+ c = DB->data2ptr(data);
if (
(g = guild->search(c->guild_id)) == NULL ||
@@ -332,7 +332,7 @@ int guild_payexp_timer(int tid, unsigned int tick, int id, intptr_t data)
*/
int guild_send_xy_timer_sub(DBKey key, DBData *data, va_list ap)
{
- struct guild *g = iDB->data2ptr(data);
+ struct guild *g = DB->data2ptr(data);
int i;
nullpo_ret(g);
@@ -386,7 +386,7 @@ int guild_create(struct map_session_data *sd, const char *name)
clif->guild_created(sd,1);
return 0;
}
- if( battle_config.guild_emperium_check && iPc->search_inventory(sd,714) == -1 )
+ if( battle_config.guild_emperium_check && pc->search_inventory(sd,714) == -1 )
{// item required
clif->guild_created(sd,3);
return 0;
@@ -412,7 +412,7 @@ int guild_created(int account_id,int guild_id) {
sd->status.guild_id=guild_id;
clif->guild_created(sd,0);
if(battle_config.guild_emperium_check)
- iPc->delitem(sd,iPc->search_inventory(sd,ITEMID_EMPERIUM),1,0,0,LOG_TYPE_CONSUME); //emperium consumption
+ pc->delitem(sd,pc->search_inventory(sd,ITEMID_EMPERIUM),1,0,0,LOG_TYPE_CONSUME); //emperium consumption
return 0;
}
@@ -440,8 +440,8 @@ int guild_npc_request_info(int guild_id,const char *event)
ev=(struct eventlist *)aCalloc(sizeof(struct eventlist),1);
memcpy(ev->name,event,strlen(event));
//The one in the db (if present) becomes the next event from this.
- if (guild_infoevent_db->put(guild_infoevent_db, iDB->i2key(guild_id), iDB->ptr2data(ev), &prev))
- ev->next = iDB->data2ptr(&prev);
+ if (guild_infoevent_db->put(guild_infoevent_db, DB->i2key(guild_id), DB->ptr2data(ev), &prev))
+ ev->next = DB->data2ptr(&prev);
}
return guild->request_info(guild_id);
@@ -618,8 +618,8 @@ int guild_recv_info(struct guild *sg) {
}
//Occurrence of an event
- if (guild_infoevent_db->remove(guild_infoevent_db, iDB->i2key(sg->guild_id), &data)) {
- struct eventlist *ev = iDB->data2ptr(&data), *ev2;
+ if (guild_infoevent_db->remove(guild_infoevent_db, DB->i2key(sg->guild_id), &data)) {
+ struct eventlist *ev = DB->data2ptr(&data), *ev2;
while(ev) {
npc_event_do(ev->name);
ev2=ev->next;
@@ -1247,7 +1247,7 @@ static DBData create_expcache(DBKey key, va_list args)
c->account_id = sd->status.account_id;
c->char_id = sd->status.char_id;
c->exp = 0;
- return iDB->ptr2data(c);
+ return DB->ptr2data(c);
}
/*====================================================
@@ -1273,7 +1273,7 @@ unsigned int guild_payexp(struct map_session_data *sd,unsigned int exp) {
exp = exp * per / 100;
//Otherwise tax everything.
- c = iDB->data2ptr(guild_expcache_db->ensure(guild_expcache_db, iDB->i2key(sd->status.char_id), create_expcache, sd));
+ c = DB->data2ptr(guild_expcache_db->ensure(guild_expcache_db, DB->i2key(sd->status.char_id), create_expcache, sd));
if (c->exp > UINT64_MAX - exp)
c->exp = UINT64_MAX;
@@ -1296,7 +1296,7 @@ int guild_getexp(struct map_session_data *sd,int exp)
if (sd->status.guild_id == 0 || sd->guild == NULL)
return 0;
- c = iDB->data2ptr(guild_expcache_db->ensure(guild_expcache_db, iDB->i2key(sd->status.char_id), create_expcache, sd));
+ c = DB->data2ptr(guild_expcache_db->ensure(guild_expcache_db, DB->i2key(sd->status.char_id), create_expcache, sd));
if (c->exp > UINT64_MAX - exp)
c->exp = UINT64_MAX;
else
@@ -1696,7 +1696,7 @@ int guild_allianceack(int guild_id1,int guild_id2,int account_id1,int account_id
*/
int guild_broken_sub(DBKey key, DBData *data, va_list ap)
{
- struct guild *g = iDB->data2ptr(data);
+ struct guild *g = DB->data2ptr(data);
int guild_id=va_arg(ap,int);
int i,j;
struct map_session_data *sd=NULL;
@@ -1721,7 +1721,7 @@ int guild_broken_sub(DBKey key, DBData *data, va_list ap)
*/
int castle_guild_broken_sub(DBKey key, DBData *data, va_list ap)
{
- struct guild_castle *gc = iDB->data2ptr(data);
+ struct guild_castle *gc = DB->data2ptr(data);
int guild_id = va_arg(ap, int);
nullpo_ret(gc);
@@ -2149,7 +2149,7 @@ void guild_flag_remove(struct npc_data *nd) {
*/
static int eventlist_db_final(DBKey key, DBData *data, va_list ap) {
struct eventlist *next = NULL;
- struct eventlist *current = iDB->data2ptr(data);
+ struct eventlist *current = DB->data2ptr(data);
while (current != NULL) {
next = current->next;
aFree(current);
@@ -2162,7 +2162,7 @@ static int eventlist_db_final(DBKey key, DBData *data, va_list ap) {
* @see DBApply
*/
static int guild_expcache_db_final(DBKey key, DBData *data, va_list ap) {
- ers_free(expcache_ers, iDB->data2ptr(data));
+ ers_free(expcache_ers, DB->data2ptr(data));
return 0;
}
@@ -2170,7 +2170,7 @@ static int guild_expcache_db_final(DBKey key, DBData *data, va_list ap) {
* @see DBApply
*/
static int guild_castle_db_final(DBKey key, DBData *data, va_list ap) {
- struct guild_castle* gc = iDB->data2ptr(data);
+ struct guild_castle* gc = DB->data2ptr(data);
if( gc->temp_guardians )
aFree(gc->temp_guardians);
aFree(gc);
diff --git a/src/map/homunculus.c b/src/map/homunculus.c
index 9c18b9811..efb5c0eb3 100644
--- a/src/map/homunculus.c
+++ b/src/map/homunculus.c
@@ -573,12 +573,12 @@ bool homunculus_feed(struct map_session_data *sd, struct homun_data *hd) {
return false;
foodID = hd->homunculusDB->foodID;
- i = iPc->search_inventory(sd,foodID);
+ i = pc->search_inventory(sd,foodID);
if(i < 0) {
clif->hom_food(sd,foodID,0);
return false;
}
- iPc->delitem(sd,i,1,0,0,LOG_TYPE_CONSUME);
+ pc->delitem(sd,i,1,0,0,LOG_TYPE_CONSUME);
if ( hd->homunculus.hunger >= 91 ) {
homun->consume_intimacy(hd, 50);
diff --git a/src/map/instance.c b/src/map/instance.c
index def0a43a8..690f14cfe 100644
--- a/src/map/instance.c
+++ b/src/map/instance.c
@@ -64,7 +64,7 @@ int instance_create(int owner_id, const char *name, enum instance_owner_type typ
icptr = &sd->instances;
break;
case IOT_PARTY:
- if( ( p = iParty->search(owner_id) ) == NULL ) {
+ if( ( p = party->search(owner_id) ) == NULL ) {
ShowError("instance_create: party %d not found for instance '%s'.\n", owner_id, name);
return -2;
}
@@ -295,7 +295,7 @@ int instance_del_load(struct map_session_data* sd, va_list args) {
if( !sd || sd->bl.m != m )
return 0;
- iPc->setpos(sd, sd->status.save_point.map, sd->status.save_point.x, sd->status.save_point.y, CLR_OUTSIGHT);
+ pc->setpos(sd, sd->status.save_point.map, sd->status.save_point.x, sd->status.save_point.y, CLR_OUTSIGHT);
return 1;
}
@@ -416,7 +416,7 @@ void instance_destroy(int instance_id) {
icptr = &sd->instances;
break;
case IOT_PARTY:
- if( ( p = iParty->search(instances[instance_id].owner_id) ) == NULL ) {
+ if( ( p = party->search(instances[instance_id].owner_id) ) == NULL ) {
break;
}
iptr = p->instance;
@@ -532,9 +532,9 @@ void instance_check_kick(struct map_session_data *sd) {
clif->instance_leave(sd->fd);
if( map[m].instance_id >= 0 ) { // User was on the instance map
if( map[m].save.map )
- iPc->setpos(sd, map[m].save.map, map[m].save.x, map[m].save.y, CLR_TELEPORT);
+ pc->setpos(sd, map[m].save.map, map[m].save.x, map[m].save.y, CLR_TELEPORT);
else
- iPc->setpos(sd, sd->status.save_point.map, sd->status.save_point.x, sd->status.save_point.y, CLR_TELEPORT);
+ pc->setpos(sd, sd->status.save_point.map, sd->status.save_point.x, sd->status.save_point.y, CLR_TELEPORT);
}
}
diff --git a/src/map/intif.c b/src/map/intif.c
index 607300e57..3cdf93487 100644
--- a/src/map/intif.c
+++ b/src/map/intif.c
@@ -993,7 +993,7 @@ int intif_parse_Registers(int fd)
*qty = j;
if (flag && sd->save_reg.global_num > -1 && sd->save_reg.account_num > -1 && sd->save_reg.account2_num > -1)
- iPc->reg_received(sd); //Received all registry values, execute init scripts and what-not. [Skotlex]
+ pc->reg_received(sd); //Received all registry values, execute init scripts and what-not. [Skotlex]
return 1;
}
@@ -1047,7 +1047,7 @@ int intif_parse_PartyCreated(int fd)
{
if(battle_config.etc_log)
ShowInfo("intif: party created by account %d\n\n", RFIFOL(fd,2));
- iParty->created(RFIFOL(fd,2), RFIFOL(fd,6),RFIFOB(fd,10),RFIFOL(fd,11), (char *)RFIFOP(fd,15));
+ party->created(RFIFOL(fd,2), RFIFOL(fd,6),RFIFOB(fd,10),RFIFOL(fd,11), (char *)RFIFOP(fd,15));
return 0;
}
@@ -1056,13 +1056,13 @@ int intif_parse_PartyInfo(int fd)
{
if( RFIFOW(fd,2) == 12 ){
ShowWarning("intif: party noinfo (char_id=%d party_id=%d)\n", RFIFOL(fd,4), RFIFOL(fd,8));
- iParty->recv_noinfo(RFIFOL(fd,8), RFIFOL(fd,4));
+ party->recv_noinfo(RFIFOL(fd,8), RFIFOL(fd,4));
return 0;
}
if( RFIFOW(fd,2) != 8+sizeof(struct party) )
ShowError("intif: party info : data size error (char_id=%d party_id=%d packet_len=%d expected_len=%d)\n", RFIFOL(fd,4), RFIFOL(fd,8), RFIFOW(fd,2), 8+sizeof(struct party));
- iParty->recv_info((struct party *)RFIFOP(fd,8), RFIFOL(fd,4));
+ party->recv_info((struct party *)RFIFOP(fd,8), RFIFOL(fd,4));
return 0;
}
@@ -1071,14 +1071,14 @@ int intif_parse_PartyMemberAdded(int fd)
{
if(battle_config.etc_log)
ShowInfo("intif: party member added Party (%d), Account(%d), Char(%d)\n",RFIFOL(fd,2),RFIFOL(fd,6),RFIFOL(fd,10));
- iParty->member_added(RFIFOL(fd,2),RFIFOL(fd,6),RFIFOL(fd,10), RFIFOB(fd, 14));
+ party->member_added(RFIFOL(fd,2),RFIFOL(fd,6),RFIFOL(fd,10), RFIFOB(fd, 14));
return 0;
}
// ACK changing party option
int intif_parse_PartyOptionChanged(int fd)
{
- iParty->optionchanged(RFIFOL(fd,2),RFIFOL(fd,6),RFIFOW(fd,10),RFIFOW(fd,12),RFIFOB(fd,14));
+ party->optionchanged(RFIFOL(fd,2),RFIFOL(fd,6),RFIFOW(fd,10),RFIFOW(fd,12),RFIFOB(fd,14));
return 0;
}
@@ -1087,28 +1087,28 @@ int intif_parse_PartyMemberWithdraw(int fd)
{
if(battle_config.etc_log)
ShowInfo("intif: party member withdraw: Party(%d), Account(%d), Char(%d)\n",RFIFOL(fd,2),RFIFOL(fd,6),RFIFOL(fd,10));
- iParty->member_withdraw(RFIFOL(fd,2),RFIFOL(fd,6),RFIFOL(fd,10));
+ party->member_withdraw(RFIFOL(fd,2),RFIFOL(fd,6),RFIFOL(fd,10));
return 0;
}
// ACK party break
int intif_parse_PartyBroken(int fd)
{
- iParty->broken(RFIFOL(fd,2));
+ party->broken(RFIFOL(fd,2));
return 0;
}
// ACK party on new map
int intif_parse_PartyMove(int fd)
{
- iParty->recv_movemap(RFIFOL(fd,2),RFIFOL(fd,6),RFIFOL(fd,10),RFIFOW(fd,14),RFIFOB(fd,16),RFIFOW(fd,17));
+ party->recv_movemap(RFIFOL(fd,2),RFIFOL(fd,6),RFIFOL(fd,10),RFIFOW(fd,14),RFIFOB(fd,16),RFIFOW(fd,17));
return 0;
}
// ACK party messages
int intif_parse_PartyMessage(int fd)
{
- iParty->recv_message(RFIFOL(fd,4),RFIFOL(fd,8),(char *) RFIFOP(fd,12),RFIFOW(fd,2)-12);
+ party->recv_message(RFIFOL(fd,4),RFIFOL(fd,8),(char *) RFIFOP(fd,12),RFIFOW(fd,2)-12);
return 0;
}
@@ -1821,9 +1821,9 @@ static void intif_parse_Auction_register(int fd)
int zeny = auction.hours*battle_config.auction_feeperhour;
clif->auction_message(sd->fd, 4);
- iPc->additem(sd, &auction.item, auction.item.amount, LOG_TYPE_AUCTION);
+ pc->additem(sd, &auction.item, auction.item.amount, LOG_TYPE_AUCTION);
- iPc->getzeny(sd, zeny, LOG_TYPE_AUCTION, NULL);
+ pc->getzeny(sd, zeny, LOG_TYPE_AUCTION, NULL);
}
}
@@ -1919,7 +1919,7 @@ static void intif_parse_Auction_bid(int fd)
clif->auction_message(sd->fd, result);
if( bid > 0 ) {
- iPc->getzeny(sd, bid, LOG_TYPE_AUCTION,NULL);
+ pc->getzeny(sd, bid, LOG_TYPE_AUCTION,NULL);
}
if( result == 1 ) { // To update the list, display your buy list
clif->pAuction_cancelreg(fd, sd);
diff --git a/src/map/itemdb.c b/src/map/itemdb.c
index e0cb642fb..cb845111d 100644
--- a/src/map/itemdb.c
+++ b/src/map/itemdb.c
@@ -30,7 +30,7 @@ struct item_data dummy_item; //This is the default dummy item used for non-exist
*/
static int itemdb_searchname_sub(DBKey key, DBData *data, va_list ap)
{
- struct item_data *item = iDB->data2ptr(data), **dst, **dst2;
+ struct item_data *item = DB->data2ptr(data), **dst, **dst2;
char *str;
str=va_arg(ap,char *);
dst=va_arg(ap,struct item_data **);
@@ -83,7 +83,7 @@ struct item_data* itemdb_searchname(const char *str)
*/
static int itemdb_searchname_array_sub(DBKey key, DBData data, va_list ap)
{
- struct item_data *item = iDB->data2ptr(&data);
+ struct item_data *item = DB->data2ptr(&data);
char *str;
str=va_arg(ap,char *);
if (item == &dummy_item)
@@ -127,7 +127,7 @@ int itemdb_searchname_array(struct item_data** data, int size, const char *str)
size -= count;
db_count = itemdb_other->getall(itemdb_other, (DBData**)&db_data, size, itemdb_searchname_array_sub, str);
for (i = 0; i < db_count; i++)
- data[count++] = iDB->data2ptr(db_data[i]);
+ data[count++] = DB->data2ptr(db_data[i]);
count += db_count;
}
return count;
@@ -1293,14 +1293,13 @@ uint64 itemdb_unique_id(int8 flag, int64 value) {
return ++item_uid;
}
-int itemdb_uid_load(){
+int itemdb_uid_load() {
char * uid;
- if (SQL_ERROR == SQL->Query(mmysql_handle, "SELECT `value` FROM `interreg` WHERE `varname`='unique_id'"))
+ if (SQL_ERROR == SQL->Query(mmysql_handle, "SELECT `value` FROM `%s` WHERE `varname`='unique_id'",iMap->interreg_db))
Sql_ShowDebug(mmysql_handle);
- if( SQL_SUCCESS != SQL->NextRow(mmysql_handle) )
- {
+ if( SQL_SUCCESS != SQL->NextRow(mmysql_handle) ) {
ShowError("itemdb_uid_load: Unable to fetch unique_id data\n");
SQL->FreeResult(mmysql_handle);
return -1;
@@ -1376,7 +1375,7 @@ static void destroy_item_data(struct item_data* self, int free_self)
*/
static int itemdb_final_sub(DBKey key, DBData *data, va_list ap)
{
- struct item_data *id = iDB->data2ptr(data);
+ struct item_data *id = DB->data2ptr(data);
if( id != &dummy_item )
destroy_item_data(id, 1);
@@ -1435,7 +1434,7 @@ void itemdb_reload(void)
iter = mapit_geteachpc();
for( sd = (struct map_session_data*)mapit->first(iter); mapit->exists(iter); sd = (struct map_session_data*)mapit->next(iter) ) {
memset(sd->item_delay, 0, sizeof(sd->item_delay)); // reset item delays
- iPc->setinventorydata(sd);
+ pc->setinventorydata(sd);
/* clear combo bonuses */
if( sd->combos.count ) {
aFree(sd->combos.bonus);
@@ -1443,7 +1442,7 @@ void itemdb_reload(void)
sd->combos.bonus = NULL;
sd->combos.id = NULL;
sd->combos.count = 0;
- if( iPc->load_combo(sd) > 0 )
+ if( pc->load_combo(sd) > 0 )
status_calc_pc(sd,0);
}
diff --git a/src/map/log.c b/src/map/log.c
index 8823a9a66..dfb4c4a61 100644
--- a/src/map/log.c
+++ b/src/map/log.c
@@ -118,16 +118,16 @@ static bool should_log_item(int nameid, int amount, int refine, struct item_data
}
void log_branch_sub_sql(struct map_session_data* sd) {
SqlStmt* stmt;
- stmt = SqlStmt_Malloc(logmysql_handle);
- if( SQL_SUCCESS != SqlStmt_Prepare(stmt, LOG_QUERY " INTO `%s` (`branch_date`, `account_id`, `char_id`, `char_name`, `map`) VALUES (NOW(), '%d', '%d', ?, '%s')", logs->config.log_branch, sd->status.account_id, sd->status.char_id, mapindex_id2name(sd->mapindex) )
- || SQL_SUCCESS != SqlStmt_BindParam(stmt, 0, SQLDT_STRING, sd->status.name, strnlen(sd->status.name, NAME_LENGTH))
- || SQL_SUCCESS != SqlStmt_Execute(stmt) )
+ stmt = SQL->StmtMalloc(logmysql_handle);
+ if( SQL_SUCCESS != SQL->StmtPrepare(stmt, LOG_QUERY " INTO `%s` (`branch_date`, `account_id`, `char_id`, `char_name`, `map`) VALUES (NOW(), '%d', '%d', ?, '%s')", logs->config.log_branch, sd->status.account_id, sd->status.char_id, mapindex_id2name(sd->mapindex) )
+ || SQL_SUCCESS != SQL->StmtBindParam(stmt, 0, SQLDT_STRING, sd->status.name, strnlen(sd->status.name, NAME_LENGTH))
+ || SQL_SUCCESS != SQL->StmtExecute(stmt) )
{
SqlStmt_ShowDebug(stmt);
- SqlStmt_Free(stmt);
+ SQL->StmtFree(stmt);
return;
}
- SqlStmt_Free(stmt);
+ SQL->StmtFree(stmt);
}
void log_branch_sub_txt(struct map_session_data* sd) {
char timestring[255];
@@ -260,17 +260,17 @@ void log_mvpdrop(struct map_session_data* sd, int monster_id, int* log_mvp)
void log_atcommand_sub_sql(struct map_session_data* sd, const char* message) {
SqlStmt* stmt;
- stmt = SqlStmt_Malloc(logmysql_handle);
- if( SQL_SUCCESS != SqlStmt_Prepare(stmt, LOG_QUERY " INTO `%s` (`atcommand_date`, `account_id`, `char_id`, `char_name`, `map`, `command`) VALUES (NOW(), '%d', '%d', ?, '%s', ?)", logs->config.log_gm, sd->status.account_id, sd->status.char_id, mapindex_id2name(sd->mapindex) )
- || SQL_SUCCESS != SqlStmt_BindParam(stmt, 0, SQLDT_STRING, sd->status.name, strnlen(sd->status.name, NAME_LENGTH))
- || SQL_SUCCESS != SqlStmt_BindParam(stmt, 1, SQLDT_STRING, (char*)message, safestrnlen(message, 255))
- || SQL_SUCCESS != SqlStmt_Execute(stmt) )
+ stmt = SQL->StmtMalloc(logmysql_handle);
+ if( SQL_SUCCESS != SQL->StmtPrepare(stmt, LOG_QUERY " INTO `%s` (`atcommand_date`, `account_id`, `char_id`, `char_name`, `map`, `command`) VALUES (NOW(), '%d', '%d', ?, '%s', ?)", logs->config.log_gm, sd->status.account_id, sd->status.char_id, mapindex_id2name(sd->mapindex) )
+ || SQL_SUCCESS != SQL->StmtBindParam(stmt, 0, SQLDT_STRING, sd->status.name, strnlen(sd->status.name, NAME_LENGTH))
+ || SQL_SUCCESS != SQL->StmtBindParam(stmt, 1, SQLDT_STRING, (char*)message, safestrnlen(message, 255))
+ || SQL_SUCCESS != SQL->StmtExecute(stmt) )
{
SqlStmt_ShowDebug(stmt);
- SqlStmt_Free(stmt);
+ SQL->StmtFree(stmt);
return;
}
- SqlStmt_Free(stmt);
+ SQL->StmtFree(stmt);
}
void log_atcommand_sub_txt(struct map_session_data* sd, const char* message) {
char timestring[255];
@@ -298,17 +298,17 @@ void log_atcommand(struct map_session_data* sd, const char* message)
void log_npc_sub_sql(struct map_session_data *sd, const char *message) {
SqlStmt* stmt;
- stmt = SqlStmt_Malloc(logmysql_handle);
- if( SQL_SUCCESS != SqlStmt_Prepare(stmt, LOG_QUERY " INTO `%s` (`npc_date`, `account_id`, `char_id`, `char_name`, `map`, `mes`) VALUES (NOW(), '%d', '%d', ?, '%s', ?)", logs->config.log_npc, sd->status.account_id, sd->status.char_id, mapindex_id2name(sd->mapindex) )
- || SQL_SUCCESS != SqlStmt_BindParam(stmt, 0, SQLDT_STRING, sd->status.name, strnlen(sd->status.name, NAME_LENGTH))
- || SQL_SUCCESS != SqlStmt_BindParam(stmt, 1, SQLDT_STRING, (char*)message, safestrnlen(message, 255))
- || SQL_SUCCESS != SqlStmt_Execute(stmt) )
+ stmt = SQL->StmtMalloc(logmysql_handle);
+ if( SQL_SUCCESS != SQL->StmtPrepare(stmt, LOG_QUERY " INTO `%s` (`npc_date`, `account_id`, `char_id`, `char_name`, `map`, `mes`) VALUES (NOW(), '%d', '%d', ?, '%s', ?)", logs->config.log_npc, sd->status.account_id, sd->status.char_id, mapindex_id2name(sd->mapindex) )
+ || SQL_SUCCESS != SQL->StmtBindParam(stmt, 0, SQLDT_STRING, sd->status.name, strnlen(sd->status.name, NAME_LENGTH))
+ || SQL_SUCCESS != SQL->StmtBindParam(stmt, 1, SQLDT_STRING, (char*)message, safestrnlen(message, 255))
+ || SQL_SUCCESS != SQL->StmtExecute(stmt) )
{
SqlStmt_ShowDebug(stmt);
- SqlStmt_Free(stmt);
+ SQL->StmtFree(stmt);
return;
}
- SqlStmt_Free(stmt);
+ SQL->StmtFree(stmt);
}
void log_npc_sub_txt(struct map_session_data *sd, const char *message) {
char timestring[255];
@@ -336,17 +336,17 @@ void log_npc(struct map_session_data* sd, const char* message)
void log_chat_sub_sql(e_log_chat_type type, int type_id, int src_charid, int src_accid, const char* map, int x, int y, const char* dst_charname, const char* message) {
SqlStmt* stmt;
- stmt = SqlStmt_Malloc(logmysql_handle);
- if( SQL_SUCCESS != SqlStmt_Prepare(stmt, LOG_QUERY " INTO `%s` (`time`, `type`, `type_id`, `src_charid`, `src_accountid`, `src_map`, `src_map_x`, `src_map_y`, `dst_charname`, `message`) VALUES (NOW(), '%c', '%d', '%d', '%d', '%s', '%d', '%d', ?, ?)", logs->config.log_chat, log_chattype2char(type), type_id, src_charid, src_accid, map, x, y)
- || SQL_SUCCESS != SqlStmt_BindParam(stmt, 0, SQLDT_STRING, (char*)dst_charname, safestrnlen(dst_charname, NAME_LENGTH))
- || SQL_SUCCESS != SqlStmt_BindParam(stmt, 1, SQLDT_STRING, (char*)message, safestrnlen(message, CHAT_SIZE_MAX))
- || SQL_SUCCESS != SqlStmt_Execute(stmt) )
+ stmt = SQL->StmtMalloc(logmysql_handle);
+ if( SQL_SUCCESS != SQL->StmtPrepare(stmt, LOG_QUERY " INTO `%s` (`time`, `type`, `type_id`, `src_charid`, `src_accountid`, `src_map`, `src_map_x`, `src_map_y`, `dst_charname`, `message`) VALUES (NOW(), '%c', '%d', '%d', '%d', '%s', '%d', '%d', ?, ?)", logs->config.log_chat, log_chattype2char(type), type_id, src_charid, src_accid, map, x, y)
+ || SQL_SUCCESS != SQL->StmtBindParam(stmt, 0, SQLDT_STRING, (char*)dst_charname, safestrnlen(dst_charname, NAME_LENGTH))
+ || SQL_SUCCESS != SQL->StmtBindParam(stmt, 1, SQLDT_STRING, (char*)message, safestrnlen(message, CHAT_SIZE_MAX))
+ || SQL_SUCCESS != SQL->StmtExecute(stmt) )
{
SqlStmt_ShowDebug(stmt);
- SqlStmt_Free(stmt);
+ SQL->StmtFree(stmt);
return;
}
- SqlStmt_Free(stmt);
+ SQL->StmtFree(stmt);
}
void log_chat_sub_txt(e_log_chat_type type, int type_id, int src_charid, int src_accid, const char* map, int x, int y, const char* dst_charname, const char* message) {
char timestring[255];
diff --git a/src/map/mail.c b/src/map/mail.c
index ab3d78ed2..299fb5117 100644
--- a/src/map/mail.c
+++ b/src/map/mail.c
@@ -31,7 +31,7 @@ int mail_removeitem(struct map_session_data *sd, short flag)
if( sd->mail.amount )
{
if (flag) // Item send
- iPc->delitem(sd, sd->mail.index, sd->mail.amount, 1, 0, LOG_TYPE_MAIL);
+ pc->delitem(sd, sd->mail.index, sd->mail.amount, 1, 0, LOG_TYPE_MAIL);
else
clif->additem(sd, sd->mail.index, sd->mail.amount, 0);
}
@@ -48,7 +48,7 @@ int mail_removezeny(struct map_session_data *sd, short flag)
if (flag && sd->mail.zeny > 0)
{ //Zeny send
- iPc->payzeny(sd,sd->mail.zeny,LOG_TYPE_MAIL, NULL);
+ pc->payzeny(sd,sd->mail.zeny,LOG_TYPE_MAIL, NULL);
}
sd->mail.zeny = 0;
@@ -61,7 +61,7 @@ unsigned char mail_setitem(struct map_session_data *sd, int idx, int amount) {
return 1;
if( idx == 0 ) { // Zeny Transfer
- if( amount < 0 || !iPc->can_give_items(sd) )
+ if( amount < 0 || !pc->can_give_items(sd) )
return 1;
if( amount > sd->status.zeny )
@@ -78,8 +78,8 @@ unsigned char mail_setitem(struct map_session_data *sd, int idx, int amount) {
return 1;
if( amount < 0 || amount > sd->status.inventory[idx].amount )
return 1;
- if( !iPc->can_give_items(sd) || sd->status.inventory[idx].expire_time ||
- !itemdb_canmail(&sd->status.inventory[idx],iPc->get_group_level(sd)) )
+ if( !pc->can_give_items(sd) || sd->status.inventory[idx].expire_time ||
+ !itemdb_canmail(&sd->status.inventory[idx],pc->get_group_level(sd)) )
return 1;
sd->mail.index = idx;
@@ -131,13 +131,13 @@ void mail_getattachment(struct map_session_data* sd, int zeny, struct item* item
{
if( item->nameid > 0 && item->amount > 0 )
{
- iPc->additem(sd, item, item->amount, LOG_TYPE_MAIL);
+ pc->additem(sd, item, item->amount, LOG_TYPE_MAIL);
clif->mail_getattachment(sd->fd, 0);
}
if( zeny > 0 )
{ //Zeny receive
- iPc->getzeny(sd, zeny,LOG_TYPE_MAIL, NULL);
+ pc->getzeny(sd, zeny,LOG_TYPE_MAIL, NULL);
}
}
@@ -161,12 +161,12 @@ void mail_deliveryfail(struct map_session_data *sd, struct mail_message *msg)
if( msg->item.amount > 0 )
{
// Item receive (due to failure)
- iPc->additem(sd, &msg->item, msg->item.amount, LOG_TYPE_MAIL);
+ pc->additem(sd, &msg->item, msg->item.amount, LOG_TYPE_MAIL);
}
if( msg->zeny > 0 )
{
- iPc->getzeny(sd,msg->zeny,LOG_TYPE_MAIL, NULL); //Zeny receive (due to failure)
+ pc->getzeny(sd,msg->zeny,LOG_TYPE_MAIL, NULL); //Zeny receive (due to failure)
}
clif->mail_send(sd->fd, true);
@@ -175,7 +175,7 @@ void mail_deliveryfail(struct map_session_data *sd, struct mail_message *msg)
// This function only check if the mail operations are valid
bool mail_invalid_operation(struct map_session_data *sd)
{
- if( !map[sd->bl.m].flag.town && !iPc->can_use_command(sd, "@mail") )
+ if( !map[sd->bl.m].flag.town && !pc->can_use_command(sd, "@mail") )
{
ShowWarning("clif->parse_Mail: char '%s' trying to do invalid mail operations.\n", sd->status.name);
return true;
diff --git a/src/map/map.c b/src/map/map.c
index 496802d28..0dab56d21 100644
--- a/src/map/map.c
+++ b/src/map/map.c
@@ -1490,7 +1490,7 @@ static DBData create_charid2nick(DBKey key, va_list args)
{
struct charid2nick *p;
CREATE(p, struct charid2nick, 1);
- return iDB->ptr2data(p);
+ return DB->ptr2data(p);
}
/// Adds(or replaces) the nick of charid to nick_db and fullfils pending requests.
@@ -1526,7 +1526,7 @@ void map_delnickdb(int charid, const char* name)
struct map_session_data* sd;
DBData data;
- if (!nick_db->remove(nick_db, iDB->i2key(charid), &data) || (p = iDB->data2ptr(&data)) == NULL)
+ if (!nick_db->remove(nick_db, DB->i2key(charid), &data) || (p = DB->data2ptr(&data)) == NULL)
return;
while( p->requests ) {
@@ -1647,7 +1647,7 @@ int map_quit(struct map_session_data *sd) {
if( sd->bg_id )
bg_team_leave(sd,1);
- iPc->itemcd_do(sd,false);
+ pc->itemcd_do(sd,false);
for( i = 0; i < sd->queues_count; i++ ) {
struct hQueue *queue;
@@ -1711,8 +1711,8 @@ int map_quit(struct map_session_data *sd) {
for( i = 0; i < EQI_MAX; i++ ) {
if( sd->equip_index[ i ] >= 0 )
- if( !iPc->isequip( sd , sd->equip_index[ i ] ) )
- iPc->unequipitem( sd , sd->equip_index[ i ] , 2 );
+ if( !pc->isequip( sd , sd->equip_index[ i ] ) )
+ pc->unequipitem( sd , sd->equip_index[ i ] , 2 );
}
// Return loot to owner
@@ -1751,9 +1751,9 @@ int map_quit(struct map_session_data *sd) {
}
}
- iParty->booking_delete(sd); // Party Booking [Spiria]
- iPc->makesavestatus(sd);
- iPc->clean_skilltree(sd);
+ party->booking_delete(sd); // Party Booking [Spiria]
+ pc->makesavestatus(sd);
+ pc->clean_skilltree(sd);
chrif_save(sd,1);
unit_free_pc(sd);
return 0;
@@ -2751,7 +2751,7 @@ static DBData create_map_data_other_server(DBKey key, va_list args)
mdos=(struct map_data_other_server *)aCalloc(1,sizeof(struct map_data_other_server));
mdos->index = mapindex;
memcpy(mdos->name, mapindex_id2name(mapindex), MAP_NAME_LENGTH);
- return iDB->ptr2data(mdos);
+ return DB->ptr2data(mdos);
}
/*==========================================
@@ -2781,7 +2781,7 @@ int map_setipport(unsigned short mapindex, uint32 ip, uint16 port)
*/
int map_eraseallipport_sub(DBKey key, DBData *data, va_list va)
{
- struct map_data_other_server *mdos = iDB->data2ptr(data);
+ struct map_data_other_server *mdos = DB->data2ptr(data);
if(mdos->cell == NULL) {
db_remove(map_db,key);
aFree(mdos);
@@ -3526,82 +3526,71 @@ void map_reloadnpc(bool clear)
#endif
}
-int inter_config_read(char *cfgName)
-{
+int inter_config_read(char *cfgName) {
char line[1024],w1[1024],w2[1024];
FILE *fp;
- fp=fopen(cfgName,"r");
- if(fp==NULL){
+ if( !( fp = fopen(cfgName,"r") ) ){
ShowError("File not found: %s\n",cfgName);
return 1;
}
- while(fgets(line, sizeof(line), fp))
- {
+ while(fgets(line, sizeof(line), fp)) {
if(line[0] == '/' && line[1] == '/')
continue;
+
if( sscanf(line,"%[^:]: %[^\r\n]",w1,w2) < 2 )
continue;
-
+ /* table names */
if(strcmpi(w1,"item_db_db")==0)
strcpy(iMap->item_db_db,w2);
- else
- if(strcmpi(w1,"mob_db_db")==0)
- strcpy(iMap->mob_db_db,w2);
- else
- if(strcmpi(w1,"item_db2_db")==0)
- strcpy(iMap->item_db2_db,w2);
- else
- if(strcmpi(w1,"item_db_re_db")==0)
- strcpy(iMap->item_db_re_db,w2);
- else
- if(strcmpi(w1,"mob_db2_db")==0)
- strcpy(iMap->mob_db2_db,w2);
- else
- //Map Server SQL DB
- if(strcmpi(w1,"map_server_ip")==0)
- strcpy(map_server_ip, w2);
- else
- if(strcmpi(w1,"map_server_port")==0)
- map_server_port=atoi(w2);
- else
- if(strcmpi(w1,"map_server_id")==0)
- strcpy(map_server_id, w2);
- else
- if(strcmpi(w1,"map_server_pw")==0)
- strcpy(map_server_pw, w2);
- else
- if(strcmpi(w1,"map_server_db")==0)
- strcpy(map_server_db, w2);
- else
- if(strcmpi(w1,"default_codepage")==0)
- strcpy(default_codepage, w2);
- else
- if(strcmpi(w1,"use_sql_db")==0) {
- iMap->db_use_sqldbs = config_switch(w2);
- ShowStatus ("Using SQL dbs: %s\n",w2);
- } else
- if(strcmpi(w1,"log_db_ip")==0)
- strcpy(log_db_ip, w2);
- else
- if(strcmpi(w1,"log_db_id")==0)
- strcpy(log_db_id, w2);
- else
- if(strcmpi(w1,"log_db_pw")==0)
- strcpy(log_db_pw, w2);
- else
- if(strcmpi(w1,"log_db_port")==0)
- log_db_port = atoi(w2);
- else
- if(strcmpi(w1,"log_db_db")==0)
- strcpy(log_db_db, w2);
- else
- if( mapreg_config_read(w1,w2) )
- continue;
- //support the import command, just like any other config
- else
- if(strcmpi(w1,"import")==0)
- inter_config_read(w2);
+ else if(strcmpi(w1,"mob_db_db")==0)
+ strcpy(iMap->mob_db_db,w2);
+ else if(strcmpi(w1,"item_db2_db")==0)
+ strcpy(iMap->item_db2_db,w2);
+ else if(strcmpi(w1,"item_db_re_db")==0)
+ strcpy(iMap->item_db_re_db,w2);
+ else if(strcmpi(w1,"mob_db2_db")==0)
+ strcpy(iMap->mob_db2_db,w2);
+ else if(strcmpi(w1,"mob_skill_db_db")==0)
+ strcpy(iMap->mob_skill_db_db,w2);
+ else if(strcmpi(w1,"mob_skill_db2_db")==0)
+ strcpy(iMap->mob_skill_db2_db,w2);
+ else if(strcmpi(w1,"interreg_db")==0)
+ strcpy(iMap->interreg_db,w2);
+ /* map sql stuff */
+ else if(strcmpi(w1,"map_server_ip")==0)
+ strcpy(map_server_ip, w2);
+ else if(strcmpi(w1,"map_server_port")==0)
+ map_server_port=atoi(w2);
+ else if(strcmpi(w1,"map_server_id")==0)
+ strcpy(map_server_id, w2);
+ else if(strcmpi(w1,"map_server_pw")==0)
+ strcpy(map_server_pw, w2);
+ else if(strcmpi(w1,"map_server_db")==0)
+ strcpy(map_server_db, w2);
+ else if(strcmpi(w1,"default_codepage")==0)
+ strcpy(default_codepage, w2);
+ else if(strcmpi(w1,"use_sql_db")==0) {
+ iMap->db_use_sqldbs = config_switch(w2);
+ ShowStatus ("Using SQL dbs: %s\n",w2);
+ }
+ /* sql log db */
+ else if(strcmpi(w1,"log_db_ip")==0)
+ strcpy(log_db_ip, w2);
+ else if(strcmpi(w1,"log_db_id")==0)
+ strcpy(log_db_id, w2);
+ else if(strcmpi(w1,"log_db_pw")==0)
+ strcpy(log_db_pw, w2);
+ else if(strcmpi(w1,"log_db_port")==0)
+ log_db_port = atoi(w2);
+ else if(strcmpi(w1,"log_db_db")==0)
+ strcpy(log_db_db, w2);
+ /* mapreg */
+ else if( mapreg_config_read(w1,w2) )
+ continue;
+ /* import */
+ else if(strcmpi(w1,"import")==0)
+ inter_config_read(w2);
}
fclose(fp);
@@ -4961,7 +4950,7 @@ void read_map_zone_db(void) {
* @see DBApply
*/
int map_db_final(DBKey key, DBData *data, va_list ap) {
- struct map_data_other_server *mdos = iDB->data2ptr(data);
+ struct map_data_other_server *mdos = DB->data2ptr(data);
if(mdos && iMalloc->verify_ptr(mdos) && mdos->cell == NULL)
aFree(mdos);
@@ -4974,7 +4963,7 @@ int map_db_final(DBKey key, DBData *data, va_list ap) {
*/
int nick_db_final(DBKey key, DBData *data, va_list args)
{
- struct charid2nick* p = iDB->data2ptr(data);
+ struct charid2nick* p = DB->data2ptr(data);
struct charid_request* req;
if( p == NULL )
@@ -5021,7 +5010,7 @@ int cleanup_sub(struct block_list *bl, va_list ap) {
*/
static int cleanup_db_sub(DBKey key, DBData *data, va_list va)
{
- return iMap->cleanup_sub(iDB->data2ptr(data), va);
+ return iMap->cleanup_sub(DB->data2ptr(data), va);
}
/*==========================================
@@ -5070,8 +5059,8 @@ void do_final(void)
do_final_itemdb();
do_final_storage();
guild->final();
- iParty->do_final_party();
- iPc->do_final_pc();
+ party->do_final_party();
+ pc->do_final_pc();
do_final_pet();
do_final_mob();
homun->final();
@@ -5267,17 +5256,20 @@ void map_cp_defaults(void) {
void map_hp_symbols(void) {
/* full interfaces */
HPM->share(atcommand,"atcommand");
+ HPM->share(battle,"battle");
+ HPM->share(bg,"battlegrounds");
HPM->share(buyingstore,"buyingstore");
HPM->share(clif,"clif");
HPM->share(guild,"guild");
+ HPM->share(homun,"homun");
HPM->share(ircbot,"ircbot");
HPM->share(logs,"logs");
HPM->share(script,"script");
HPM->share(searchstore,"searchstore");
HPM->share(skill,"skill");
HPM->share(vending,"vending");
- HPM->share(iPc,"iPc");
- HPM->share(iParty,"iParty");
+ HPM->share(pc,"pc");
+ HPM->share(party,"party");
HPM->share(iMap,"iMap");
/* partial */
HPM->share(mapit,"mapit");
@@ -5493,9 +5485,9 @@ int do_init(int argc, char *argv[])
skill->init();
read_map_zone_db();/* read after item and skill initalization */
do_init_mob();
- iPc->do_init_pc();
+ pc->do_init_pc();
do_init_status();
- iParty->do_init_party();
+ party->do_init_party();
guild->init();
do_init_storage();
do_init_pet();
@@ -5634,7 +5626,7 @@ void map_defaults(void) {
iMap->map_foreachregen = map_map_foreachregen;
iMap->map_foreachiddb = map_map_foreachiddb;
- iMap->foreachinrange = iMap->foreachinrange;
+ iMap->foreachinrange = map_foreachinrange;
iMap->foreachinshootrange = map_foreachinshootrange;
iMap->foreachinarea=map_foreachinarea;
iMap->forcountinrange=map_forcountinrange;
diff --git a/src/map/map.h b/src/map/map.h
index 9126f39a7..3e7c45bc3 100644
--- a/src/map/map.h
+++ b/src/map/map.h
@@ -796,6 +796,7 @@ struct map_interface {
char mob_db2_db[32];
char mob_skill_db_db[32];
char mob_skill_db2_db[32];
+ char interreg_db[32];
/* funcs */
void (*zone_init) (void);
diff --git a/src/map/mapreg_sql.c b/src/map/mapreg_sql.c
index a42ec04f2..b6865c8fd 100644
--- a/src/map/mapreg_sql.c
+++ b/src/map/mapreg_sql.c
@@ -140,25 +140,25 @@ static void script_load_mapreg(void) {
| varname | index | value |
+-------------------------+
*/
- SqlStmt* stmt = SqlStmt_Malloc(mmysql_handle);
+ SqlStmt* stmt = SQL->StmtMalloc(mmysql_handle);
char varname[32+1];
int index;
char value[255+1];
uint32 length;
- if ( SQL_ERROR == SqlStmt_Prepare(stmt, "SELECT `varname`, `index`, `value` FROM `%s`", mapreg_table)
- || SQL_ERROR == SqlStmt_Execute(stmt)
+ if ( SQL_ERROR == SQL->StmtPrepare(stmt, "SELECT `varname`, `index`, `value` FROM `%s`", mapreg_table)
+ || SQL_ERROR == SQL->StmtExecute(stmt)
) {
SqlStmt_ShowDebug(stmt);
- SqlStmt_Free(stmt);
+ SQL->StmtFree(stmt);
return;
}
- SqlStmt_BindColumn(stmt, 0, SQLDT_STRING, &varname[0], sizeof(varname), &length, NULL);
- SqlStmt_BindColumn(stmt, 1, SQLDT_INT, &index, 0, NULL, NULL);
- SqlStmt_BindColumn(stmt, 2, SQLDT_STRING, &value[0], sizeof(value), NULL, NULL);
+ SQL->StmtBindColumn(stmt, 0, SQLDT_STRING, &varname[0], sizeof(varname), &length, NULL);
+ SQL->StmtBindColumn(stmt, 1, SQLDT_INT, &index, 0, NULL, NULL);
+ SQL->StmtBindColumn(stmt, 2, SQLDT_STRING, &value[0], sizeof(value), NULL, NULL);
- while ( SQL_SUCCESS == SqlStmt_NextRow(stmt) ) {
+ while ( SQL_SUCCESS == SQL->StmtNextRow(stmt) ) {
struct mapreg_save *m = NULL;
int s = add_str(varname);
int i = index;
@@ -187,7 +187,7 @@ static void script_load_mapreg(void) {
}
}
- SqlStmt_Free(stmt);
+ SQL->StmtFree(stmt);
mapreg_i_dirty = false;
mapreg_str_dirty = false;
diff --git a/src/map/mob.c b/src/map/mob.c
index 629a79e7f..04c4bba38 100644
--- a/src/map/mob.c
+++ b/src/map/mob.c
@@ -1846,7 +1846,7 @@ static void mob_item_drop(struct mob_data *md, struct item_drop_list *dlist, str
if( sd == NULL ) sd = iMap->charid2sd(dlist->third_charid);
if( sd
- && (drop_rate <= sd->state.autoloot || iPc->isautolooting(sd, ditem->item_data.nameid))
+ && (drop_rate <= sd->state.autoloot || pc->isautolooting(sd, ditem->item_data.nameid))
&& (battle_config.idle_no_autoloot == 0 || DIFF_TICK(last_tick, sd->idletime) < battle_config.idle_no_autoloot)
&& (battle_config.homunculus_autoloot?1:!flag)
#ifdef AUTOLOOT_DISTANCE
@@ -1854,7 +1854,7 @@ static void mob_item_drop(struct mob_data *md, struct item_drop_list *dlist, str
&& check_distance_blxy(&sd->bl, dlist->x, dlist->y, AUTOLOOT_DISTANCE)
#endif
) { //Autoloot.
- if (iParty->share_loot(iParty->search(sd->status.party_id),
+ if (party->share_loot(party->search(sd->status.party_id),
sd, &ditem->item_data, sd->status.char_id) == 0
) {
ers_free(item_drop_ers, ditem);
@@ -2189,7 +2189,7 @@ int mob_dead(struct mob_data *md, struct block_list *src, int type)
else
ARR_FIND(0, MAX_PC_FEELHATE, i, temp == sd->hate_mob[i] &&
(battle_config.allow_skill_without_day || sg_info[i].day_func()));
- if(i<MAX_PC_FEELHATE && (temp=iPc->checkskill(sd,sg_info[i].bless_id)))
+ if(i<MAX_PC_FEELHATE && (temp=pc->checkskill(sd,sg_info[i].bless_id)))
bonus += (i==2?20:10)*temp;
}
if(battle_config.mobs_level_up && md->level > md->db->lv) // [Valaris]
@@ -2255,7 +2255,7 @@ int mob_dead(struct mob_data *md, struct block_list *src, int type)
for( j = 0; j < pnum && pt[j].id != temp; j++ ); //Locate party.
if( j == pnum ){ //Possibly add party.
- pt[pnum].p = iParty->search(temp);
+ pt[pnum].p = party->search(temp);
if(pt[pnum].p && pt[pnum].p->party.exp) {
pt[pnum].id = temp;
pt[pnum].base_exp = base_exp;
@@ -2285,20 +2285,20 @@ int mob_dead(struct mob_data *md, struct block_list *src, int type)
if(base_exp || job_exp) {
if( md->dmglog[i].flag != MDLF_PET || battle_config.pet_attack_exp_to_master ) {
#ifdef RENEWAL_EXP
- int rate = iPc->level_penalty_mod(tmpsd[i], md, 1);
+ int rate = pc->level_penalty_mod(tmpsd[i], md, 1);
base_exp = (unsigned int)cap_value(base_exp * rate / 100, 1, UINT_MAX);
job_exp = (unsigned int)cap_value(job_exp * rate / 100, 1, UINT_MAX);
#endif
- iPc->gainexp(tmpsd[i], &md->bl, base_exp, job_exp, false);
+ pc->gainexp(tmpsd[i], &md->bl, base_exp, job_exp, false);
}
}
if(zeny) // zeny from mobs [Valaris]
- iPc->getzeny(tmpsd[i], zeny, LOG_TYPE_PICKDROP_MONSTER, NULL);
+ pc->getzeny(tmpsd[i], zeny, LOG_TYPE_PICKDROP_MONSTER, NULL);
}
}
for( i = 0; i < pnum; i++ ) //Party share.
- iParty->exp_share(pt[i].p, &md->bl, pt[i].base_exp,pt[i].job_exp,pt[i].zeny);
+ party->exp_share(pt[i].p, &md->bl, pt[i].base_exp,pt[i].job_exp,pt[i].zeny);
} //End EXP giving.
@@ -2313,9 +2313,9 @@ int mob_dead(struct mob_data *md, struct block_list *src, int type)
struct item_data* it = NULL;
int drop_rate;
#ifdef RENEWAL_DROP
- int drop_modifier = mvp_sd ? iPc->level_penalty_mod(mvp_sd, md, 2) :
- second_sd ? iPc->level_penalty_mod(second_sd, md, 2):
- third_sd ? iPc->level_penalty_mod(third_sd, md, 2) :
+ int drop_modifier = mvp_sd ? pc->level_penalty_mod(mvp_sd, md, 2) :
+ second_sd ? pc->level_penalty_mod(second_sd, md, 2):
+ third_sd ? pc->level_penalty_mod(third_sd, md, 2) :
100;/* no player was attached, we dont use any modifier (100 = rates are not touched) */
#endif
dlist->m = md->bl.m;
@@ -2394,7 +2394,7 @@ int mob_dead(struct mob_data *md, struct block_list *src, int type)
}
// Ore Discovery [Celest]
- if (sd == mvp_sd && iPc->checkskill(sd,BS_FINDINGORE)>0 && battle_config.finding_ore_rate/10 >= rnd()%10000) {
+ if (sd == mvp_sd && pc->checkskill(sd,BS_FINDINGORE)>0 && battle_config.finding_ore_rate/10 >= rnd()%10000) {
ditem = mob_setdropitem(itemdb_searchrandomid(IG_FINDINGORE), 1, NULL);
mob_item_drop(md, dlist, ditem, 0, battle_config.finding_ore_rate/10, homkillonly);
}
@@ -2433,7 +2433,7 @@ int mob_dead(struct mob_data *md, struct block_list *src, int type)
if( sd->bonus.get_zeny_num && rnd()%100 < sd->bonus.get_zeny_rate ) {
i = sd->bonus.get_zeny_num > 0 ? sd->bonus.get_zeny_num : -md->level * sd->bonus.get_zeny_num;
if (!i) i = 1;
- iPc->getzeny(sd, 1+rnd()%i, LOG_TYPE_PICKDROP_MONSTER, NULL);
+ pc->getzeny(sd, 1+rnd()%i, LOG_TYPE_PICKDROP_MONSTER, NULL);
}
}
@@ -2479,7 +2479,7 @@ int mob_dead(struct mob_data *md, struct block_list *src, int type)
clif->mvp_effect(mvp_sd);
clif->mvp_exp(mvp_sd,mexp);
- iPc->gainexp(mvp_sd, &md->bl, mexp,0, false);
+ pc->gainexp(mvp_sd, &md->bl, mexp,0, false);
log_mvp[1] = mexp;
if( !(map[m].flag.nomvploot || type&1) ) {
@@ -2527,7 +2527,7 @@ int mob_dead(struct mob_data *md, struct block_list *src, int type)
intif_broadcast(message,strlen(message)+1,0);
}
- if((temp = iPc->additem(mvp_sd,&item,1,LOG_TYPE_PICKDROP_PLAYER)) != 0) {
+ if((temp = pc->additem(mvp_sd,&item,1,LOG_TYPE_PICKDROP_PLAYER)) != 0) {
clif->additem(mvp_sd,0,0,temp);
iMap->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);
}
@@ -2560,7 +2560,7 @@ int mob_dead(struct mob_data *md, struct block_list *src, int type)
if( sd ) {
if( sd->mission_mobid == md->class_) { //TK_MISSION [Skotlex]
if( ++sd->mission_count >= 100 && (temp = mob_get_random_id(0, 0xE, sd->status.base_level)) ) {
- iPc->addfame(sd, 1);
+ pc->addfame(sd, 1);
sd->mission_mobid = temp;
pc_setglobalreg(sd,"TK_MISSION_ID", temp);
sd->mission_count = 0;
@@ -2580,15 +2580,15 @@ int mob_dead(struct mob_data *md, struct block_list *src, int type)
if( md->npc_event[0] && !md->state.npc_killmonster ) {
if( sd && battle_config.mob_npc_event_type ) {
- iPc->setparam(sd, SP_KILLERRID, sd->bl.id);
+ pc->setparam(sd, SP_KILLERRID, sd->bl.id);
npc_event(sd,md->npc_event,0);
} else if( mvp_sd ) {
- iPc->setparam(mvp_sd, SP_KILLERRID, sd?sd->bl.id:0);
+ pc->setparam(mvp_sd, SP_KILLERRID, sd?sd->bl.id:0);
npc_event(mvp_sd,md->npc_event,0);
} else
npc_event_do(md->npc_event);
} else if( mvp_sd && !md->state.npc_killmonster ) {
- iPc->setparam(mvp_sd, SP_KILLEDRID, md->class_);
+ pc->setparam(mvp_sd, SP_KILLEDRID, md->class_);
npc_script_event(mvp_sd, NPCE_KILLNPC); // PCKillNPC [Lance]
}
@@ -3384,8 +3384,8 @@ int mob_clone_spawn(struct map_session_data *sd, int16 m, int16 x, int16 y, cons
//Go Backwards to give better priority to advanced skills.
for (i=0,j = MAX_SKILL_TREE-1;j>=0 && i< MAX_MOBSKILL ;j--) {
- int idx = skill_tree[iPc->class2idx(sd->status.class_)][j].idx;
- skill_id = skill_tree[iPc->class2idx(sd->status.class_)][j].id;
+ int idx = skill_tree[pc->class2idx(sd->status.class_)][j].idx;
+ skill_id = skill_tree[pc->class2idx(sd->status.class_)][j].id;
if (!skill_id || sd->status.skill[idx].lv < 1 ||
(skill_db[idx].inf2&(INF2_WEDDING_SKILL|INF2_GUILD_SKILL))
)
diff --git a/src/map/npc.c b/src/map/npc.c
index 7a6516d9a..5e03191e7 100644
--- a/src/map/npc.c
+++ b/src/map/npc.c
@@ -303,7 +303,7 @@ int npc_event_dequeue(struct map_session_data* sd)
if (!sd->eventqueue[0][0])
return 0; //Nothing to dequeue
- if (!iPc->addeventtimer(sd,100,sd->eventqueue[0])) { //Failed to dequeue, couldn't set a timer.
+ if (!pc->addeventtimer(sd,100,sd->eventqueue[0])) { //Failed to dequeue, couldn't set a timer.
ShowWarning("npc_event_dequeue: event timer is full !\n");
return 0;
}
@@ -350,7 +350,7 @@ int npc_event_doall_sub(DBKey key, DBData *data, va_list ap)
const char* name;
int rid;
- nullpo_ret(ev = iDB->data2ptr(data));
+ nullpo_ret(ev = DB->data2ptr(data));
nullpo_ret(c = va_arg(ap, int *));
nullpo_ret(name = va_arg(ap, const char *));
rid = va_arg(ap, int);
@@ -378,7 +378,7 @@ static int npc_event_do_sub(DBKey key, DBData *data, va_list ap)
int* c;
const char* name;
- nullpo_ret(ev = iDB->data2ptr(data));
+ nullpo_ret(ev = DB->data2ptr(data));
nullpo_ret(c = va_arg(ap, int *));
nullpo_ret(name = va_arg(ap, const char *));
@@ -954,7 +954,7 @@ int npc_touch_areanpc(struct map_session_data* sd, int16 m, int16 x, int16 y)
case WARP:
if( pc_ishiding(sd) || (sd->sc.count && sd->sc.data[SC_CAMOUFLAGE]) )
break; // hidden chars cannot use warps
- iPc->setpos(sd,map[m].npc[i]->u.warp.mapindex,map[m].npc[i]->u.warp.x,map[m].npc[i]->u.warp.y,CLR_OUTSIGHT);
+ pc->setpos(sd,map[m].npc[i]->u.warp.mapindex,map[m].npc[i]->u.warp.x,map[m].npc[i]->u.warp.y,CLR_OUTSIGHT);
break;
case SCRIPT:
for (j = i; j < map[m].npc_num; j++) {
@@ -966,7 +966,7 @@ int npc_touch_areanpc(struct map_session_data* sd, int16 m, int16 x, int16 y)
(sd->bl.y >= (map[m].npc[j]->bl.y - map[m].npc[j]->u.warp.ys) && sd->bl.y <= (map[m].npc[j]->bl.y + map[m].npc[j]->u.warp.ys))) {
if( pc_ishiding(sd) || (sd->sc.count && sd->sc.data[SC_CAMOUFLAGE]) )
break; // hidden chars cannot use warps
- iPc->setpos(sd,map[m].npc[j]->u.warp.mapindex,map[m].npc[j]->u.warp.x,map[m].npc[j]->u.warp.y,CLR_OUTSIGHT);
+ pc->setpos(sd,map[m].npc[j]->u.warp.mapindex,map[m].npc[j]->u.warp.x,map[m].npc[j]->u.warp.y,CLR_OUTSIGHT);
found_warp = 1;
break;
}
@@ -1335,7 +1335,7 @@ int npc_cashshop_buylist(struct map_session_data *sd, int points, int count, uns
amount = item_list[i*2+0] = 1;
}
- switch( iPc->checkadditem(sd,nameid,amount) )
+ switch( pc->checkadditem(sd,nameid,amount) )
{
case ADDITEM_NEW:
new_++;
@@ -1350,14 +1350,14 @@ int npc_cashshop_buylist(struct map_session_data *sd, int points, int count, uns
if( w + sd->weight > sd->max_weight )
return 3;
- if( iPc->inventoryblank(sd) < new_ )
+ if( pc->inventoryblank(sd) < new_ )
return 3;
if( points > vt ) points = vt;
// Payment Process ----------------------------------------------------
if( sd->kafraPoints < points || sd->cashPoints < (vt - points) )
return 6;
- iPc->paycash(sd,vt,points);
+ pc->paycash(sd,vt,points);
// Delivery Process ----------------------------------------------------
for( i = 0; i < count; i++ )
@@ -1373,7 +1373,7 @@ int npc_cashshop_buylist(struct map_session_data *sd, int points, int count, uns
{
item_tmp.nameid = nameid;
item_tmp.identify = 1;
- iPc->additem(sd,&item_tmp,amount,LOG_TYPE_NPC);
+ pc->additem(sd,&item_tmp,amount,LOG_TYPE_NPC);
}
}
@@ -1443,10 +1443,10 @@ int npc_cashshop_buy(struct map_session_data *sd, int nameid, int amount, int po
amount = 1;
}
- switch( iPc->checkadditem(sd, nameid, amount) )
+ switch( pc->checkadditem(sd, nameid, amount) )
{
case ADDITEM_NEW:
- if( iPc->inventoryblank(sd) == 0 )
+ if( pc->inventoryblank(sd) == 0 )
return 3;
break;
case ADDITEM_OVERAMOUNT:
@@ -1472,7 +1472,7 @@ int npc_cashshop_buy(struct map_session_data *sd, int nameid, int amount, int po
if( (sd->kafraPoints < points) || (sd->cashPoints < price - points) )
return 6;
- iPc->paycash(sd, price, points);
+ pc->paycash(sd, price, points);
if( !pet_create_egg(sd, nameid) )
{
@@ -1481,7 +1481,7 @@ int npc_cashshop_buy(struct map_session_data *sd, int nameid, int amount, int po
item_tmp.nameid = nameid;
item_tmp.identify = 1;
- iPc->additem(sd,&item_tmp, amount, LOG_TYPE_NPC);
+ pc->additem(sd,&item_tmp, amount, LOG_TYPE_NPC);
}
return 0;
@@ -1541,7 +1541,7 @@ int npc_buylist(struct map_session_data* sd, int n, unsigned short* item_list)
continue;
}
- switch( iPc->checkadditem(sd,nameid,amount) ) {
+ switch( pc->checkadditem(sd,nameid,amount) ) {
case ADDITEM_EXIST:
break;
@@ -1553,7 +1553,7 @@ int npc_buylist(struct map_session_data* sd, int n, unsigned short* item_list)
return 2;
}
- value = iPc->modifybuyvalue(sd,value);
+ value = pc->modifybuyvalue(sd,value);
z += (double)value * amount;
w += itemdb_weight(nameid) * amount;
@@ -1566,10 +1566,10 @@ int npc_buylist(struct map_session_data* sd, int n, unsigned short* item_list)
return 1; // Not enough Zeny
if( w + sd->weight > sd->max_weight )
return 2; // Too heavy
- if( iPc->inventoryblank(sd) < new_ )
+ if( pc->inventoryblank(sd) < new_ )
return 3; // Not enough space to store items
- iPc->payzeny(sd,(int)z,LOG_TYPE_NPC, NULL);
+ pc->payzeny(sd,(int)z,LOG_TYPE_NPC, NULL);
for( i = 0; i < n; ++i ) {
int nameid = item_list[i*2+1];
@@ -1583,12 +1583,12 @@ int npc_buylist(struct map_session_data* sd, int n, unsigned short* item_list)
item_tmp.nameid = nameid;
item_tmp.identify = 1;
- iPc->additem(sd,&item_tmp,amount,LOG_TYPE_NPC);
+ pc->additem(sd,&item_tmp,amount,LOG_TYPE_NPC);
}
}
// custom merchant shop exp bonus
- if( battle_config.shop_exp > 0 && z > 0 && (skill_t = iPc->checkskill2(sd,idx)) > 0 ) {
+ if( battle_config.shop_exp > 0 && z > 0 && (skill_t = pc->checkskill2(sd,idx)) > 0 ) {
if( sd->status.skill[idx].flag >= SKILL_FLAG_REPLACED_LV_0 )
skill_t = sd->status.skill[idx].flag - SKILL_FLAG_REPLACED_LV_0;
@@ -1596,7 +1596,7 @@ int npc_buylist(struct map_session_data* sd, int n, unsigned short* item_list)
z = z * (double)skill_t * (double)battle_config.shop_exp/10000.;
if( z < 1 )
z = 1;
- iPc->gainexp(sd,NULL,0,(int)z, false);
+ pc->gainexp(sd,NULL,0,(int)z, false);
}
}
@@ -1700,7 +1700,7 @@ int npc_selllist(struct map_session_data* sd, int n, unsigned short* item_list)
continue;
}
- value = iPc->modifysellvalue(sd, sd->inventory_data[idx]->value_sell);
+ value = pc->modifysellvalue(sd, sd->inventory_data[idx]->value_sell);
z+= (double)value*amount;
}
@@ -1722,16 +1722,16 @@ int npc_selllist(struct map_session_data* sd, int n, unsigned short* item_list)
}
}
- iPc->delitem(sd, idx, amount, 0, 6, LOG_TYPE_NPC);
+ pc->delitem(sd, idx, amount, 0, 6, LOG_TYPE_NPC);
}
if( z > MAX_ZENY )
z = MAX_ZENY;
- iPc->getzeny(sd, (int)z, LOG_TYPE_NPC, NULL);
+ pc->getzeny(sd, (int)z, LOG_TYPE_NPC, NULL);
// custom merchant shop exp bonus
- if( battle_config.shop_exp > 0 && z > 0 && ( skill_t = iPc->checkskill2(sd,idx) ) > 0) {
+ if( battle_config.shop_exp > 0 && z > 0 && ( skill_t = pc->checkskill2(sd,idx) ) > 0) {
if( sd->status.skill[idx].flag >= SKILL_FLAG_REPLACED_LV_0 )
skill_t = sd->status.skill[idx].flag - SKILL_FLAG_REPLACED_LV_0;
@@ -1739,7 +1739,7 @@ int npc_selllist(struct map_session_data* sd, int n, unsigned short* item_list)
z = z * (double)skill_t * (double)battle_config.shop_exp/10000.;
if( z < 1 )
z = 1;
- iPc->gainexp(sd, NULL, 0, (int)z, false);
+ pc->gainexp(sd, NULL, 0, (int)z, false);
}
}
@@ -1773,7 +1773,7 @@ int npc_remove_map(struct npc_data* nd) {
*/
static int npc_unload_ev(DBKey key, DBData *data, va_list ap)
{
- struct event_data* ev = iDB->data2ptr(data);
+ struct event_data* ev = DB->data2ptr(data);
char* npcname = va_arg(ap, char *);
if(strcmp(ev->nd->exname,npcname)==0){
@@ -2289,7 +2289,7 @@ static const char* npc_parse_shop(char* w1, char* w2, char* w3, char* w4, const
int npc_convertlabel_db(DBKey key, DBData *data, va_list ap)
{
const char* lname = (const char*)key.str;
- int lpos = iDB->data2i(data);
+ int lpos = DB->data2i(data);
struct npc_label_list** label_list;
int* label_list_num;
const char* filepath;
@@ -2933,9 +2933,9 @@ static const char* npc_parse_function(char* w1, char* w2, char* w3, char* w4, co
return end;
func_db = script_get_userfunc_db();
- if (func_db->put(func_db, iDB->str2key(w3), iDB->ptr2data(script), &old_data))
+ if (func_db->put(func_db, DB->str2key(w3), DB->ptr2data(script), &old_data))
{
- struct script_code *oldscript = (struct script_code*)iDB->data2ptr(&old_data);
+ struct script_code *oldscript = (struct script_code*)DB->data2ptr(&old_data);
ShowInfo("npc_parse_function: Overwriting user function [%s] (%s:%d)\n", w3, filepath, strline(buffer,start-buffer));
script_free_vars(oldscript->script_vars);
aFree(oldscript->script_buf);
@@ -3729,7 +3729,7 @@ void npc_read_event_script(void)
for( data = iter->first(iter,&key); iter->exists(iter); data = iter->next(iter,&key) )
{
const char* p = key.str;
- struct event_data* ed = iDB->data2ptr(data);
+ struct event_data* ed = DB->data2ptr(data);
unsigned char count = script_event[i].event_count;
if( count >= ARRAYLENGTH(script_event[i].event) )
diff --git a/src/map/packets.h b/src/map/packets.h
index 5d07f7f9e..4f2b119fb 100644
--- a/src/map/packets.h
+++ b/src/map/packets.h
@@ -1922,7 +1922,7 @@ packet(0x020d,-1);
packet(0x0885,7,clif->pActionRequest,2,6);
packet(0x0889,10,clif->pUseSkillToId,2,4,6);
packet(0x0870,-1,clif->pItemListWindowSelected,2,4,8);
- packet(0x0926,18,clif->pPartyBookingRegisterReq,2,4,6);
+ packet(0x0365,18,clif->pPartyBookingRegisterReq,2,4,6);
packet(0x0815,-1,clif->pReqOpenBuyingStore,2,4,8,9,89);
packet(0x0817,2,clif->pReqCloseBuyingStore,0);
packet(0x0360,6,clif->pReqClickBuyingStore,2);
@@ -1974,9 +1974,11 @@ packet(0x020d,-1);
packet(0x08EC,73);
packet(0x08ED,43);
packet(0x08EE,6);
+#ifdef PARTY_RECRUIT
packet(0x08EF,6,clif->pDull,2); //bookingignorereq
- packet(0x08F0,6);
+ packet(0x08F0,6,clif->pDull,2);
packet(0x08F1,6,clif->pDull,2); //bookingjoinpartyreq
+#endif
packet(0x08F2,36);
packet(0x08F3,-1);
packet(0x08F4,6);
@@ -1985,6 +1987,9 @@ packet(0x020d,-1);
packet(0x08F7,3);
packet(0x08F8,7);
packet(0x08F9,6);
+#ifdef PARTY_RECRUIT
+ packet(0x08F9,6,clif->pDull,2);
+#endif
packet(0x08FA,6);
packet(0x08FB,6,clif->pDull,2); //bookingcanceljoinparty
packet(0x0907,5,clif->pMoveItem,2,4);
@@ -2159,4 +2164,70 @@ packet(0x020d,-1);
// Shuffle End
#endif
+//2013-05-29Ragexe (Shakto)
+#if PACKETVER >= 20130529
+ packet(0x0890,7,clif->pActionRequest,2,6);
+ packet(0x0438,10,clif->pUseSkillToId,2,4,6);
+ packet(0x0876,5,clif->pWalkToXY,2);
+ packet(0x0897,6,clif->pTickSend,2);
+ packet(0x0951,5,clif->pChangeDir,2,4);
+ packet(0x0895,6,clif->pTakeItem,2);
+ packet(0x08A7,6,clif->pDropItem,2,4);
+ packet(0x0938,8,clif->pMoveToKafra,2,4);
+ packet(0x0957,8,clif->pMoveFromKafra,2,4);
+ packet(0x0917,10,clif->pUseSkillToPos,2,4,6,8);
+ packet(0x085E,90,clif->pUseSkillToPosMoreInfo,2,4,6,8,10);
+ packet(0x0863,6,clif->pGetCharNameRequest,2);
+ packet(0x0937,6,clif->pSolveCharName,2);
+ packet(0x085A,12,clif->pSearchStoreInfoListItemClick,2,6,10);
+ packet(0x0941,2,clif->pSearchStoreInfoNextPage,0);
+ packet(0x0918,-1,clif->pSearchStoreInfo,2,4,5,9,13,14,15);
+ packet(0x0936,-1,clif->pReqTradeBuyingStore,2,4,8,12);
+ packet(0x0892,6,clif->pReqClickBuyingStore,2);
+ packet(0x0964,2,clif->pReqCloseBuyingStore,0);
+ packet(0x0869,-1,clif->pReqOpenBuyingStore,2,4,8,9,89);
+ packet(0x0874,41,clif->pPartyBookingRegisterReq,2,4);
+ // packet(0x088E,8); // CZ_JOIN_BATTLE_FIELD
+ packet(0x0958,-1,clif->pItemListWindowSelected,2,4,8);
+ packet(0x0919,19,clif->pWantToConnection,2,6,10,14,18);
+ packet(0x08A8,26,clif->pPartyInvite2,2);
+ // packet(0x0888,4); // CZ_GANGSI_RANK
+ packet(0x0877,26,clif->pFriendsListAdd,2);
+ packet(0x023B,5,clif->pHomMenu,2,4);
+ packet(0x0956,36,clif->pStoragePassword,0);
+#endif
+
+//2013-06-05Ragexe (Shakto)
+#if PACKETVER >= 20130605
+ packet(0x0369,7,clif->pActionRequest,2,6);
+ packet(0x083C,10,clif->pUseSkillToId,2,4,6);
+ packet(0x0437,5,clif->pWalkToXY,2);
+ packet(0x035F,6,clif->pTickSend,2);
+ packet(0x0202,5,clif->pChangeDir,2,4);
+ packet(0x07E4,6,clif->pTakeItem,2);
+ packet(0x0362,6,clif->pDropItem,2,4);
+ packet(0x07EC,8,clif->pMoveToKafra,2,4);
+ packet(0x0364,8,clif->pMoveFromKafra,2,4);
+ packet(0x0438,10,clif->pUseSkillToPos,2,4,6,8);
+ packet(0x0366,90,clif->pUseSkillToPosMoreInfo,2,4,6,8,10);
+ packet(0x096A,6,clif->pGetCharNameRequest,2);
+ packet(0x0368,6,clif->pSolveCharName,2);
+ packet(0x0838,12,clif->pSearchStoreInfoListItemClick,2,6,10);
+ packet(0x0835,2,clif->pSearchStoreInfoNextPage,0);
+ packet(0x0819,-1,clif->pSearchStoreInfo,2,4,5,9,13,14,15);
+ packet(0x0811,-1,clif->pReqTradeBuyingStore,2,4,8,12);
+ packet(0x0360,6,clif->pReqClickBuyingStore,2);
+ packet(0x0817,2,clif->pReqCloseBuyingStore,0);
+ packet(0x0815,-1,clif->pReqOpenBuyingStore,2,4,8,9,89);
+ packet(0x0365,41,clif->pPartyBookingRegisterReq,2,4);
+ // packet(0x0363,8); // CZ_JOIN_BATTLE_FIELD
+ packet(0x0281,-1,clif->pItemListWindowSelected,2,4,8);
+ packet(0x022D,19,clif->pWantToConnection,2,6,10,14,18);
+ packet(0x0802,26,clif->pPartyInvite2,2);
+ // packet(0x0436,4); // CZ_GANGSI_RANK
+ packet(0x023B,26,clif->pFriendsListAdd,2);
+ packet(0x0361,5,clif->pHomMenu,2,4);
+ packet(0x0883,36,clif->pStoragePassword,0);
+#endif
+
#endif /* _PACKETS_H_ */
diff --git a/src/map/party.c b/src/map/party.c
index a7a002404..e30d16c07 100644
--- a/src/map/party.c
+++ b/src/map/party.c
@@ -102,7 +102,7 @@ static TBL_PC* party_sd_check(int party_id, int account_id, int char_id)
int party_db_final(DBKey key, DBData *data, va_list ap) {
struct party_data *p;
- if( ( p = iDB->data2ptr(data) ) && p->instance )
+ if( ( p = DB->data2ptr(data) ) && p->instance )
aFree(p->instance);
return 0;
@@ -209,7 +209,7 @@ int party_request_info(int party_id, int char_id)
/// Invoked (from char-server) when the party info is not found.
int party_recv_noinfo(int party_id, int char_id)
{
- iParty->broken(party_id);
+ party->broken(party_id);
if( char_id != 0 )// requester
{
struct map_session_data* sd;
@@ -297,7 +297,7 @@ int party_recv_info(struct party* sp, int char_id)
sd = p->data[member_id].sd;
if( sd == NULL )
continue;// not online
- iParty->member_withdraw(sp->party_id, sd->status.account_id, sd->status.char_id);
+ party->member_withdraw(sp->party_id, sd->status.account_id, sd->status.char_id);
}
memcpy(&p->party, sp, sizeof(struct party));
memset(&p->state, 0, sizeof(p->state));
@@ -328,7 +328,7 @@ int party_recv_info(struct party* sp, int char_id)
if( char_id != 0 )// requester
{
sd = iMap->charid2sd(char_id);
- if( sd && sd->status.party_id == sp->party_id && iParty->getmemberid(p,sd) == -1 )
+ if( sd && sd->status.party_id == sp->party_id && party->getmemberid(p,sd) == -1 )
sd->status.party_id = 0;// was not in the party
}
return 0;
@@ -341,7 +341,7 @@ int party_invite(struct map_session_data *sd,struct map_session_data *tsd)
nullpo_ret(sd);
- if( ( p = iParty->search(sd->status.party_id) ) == NULL )
+ if( ( p = party->search(sd->status.party_id) ) == NULL )
return 0;
// confirm if this player is a party leader
@@ -430,10 +430,10 @@ void party_reply_invite(struct map_session_data *sd,int party_id,int flag)
//- Player must be authed/active and belong to a party before calling this method
void party_member_joined(struct map_session_data *sd)
{
- struct party_data* p = iParty->search(sd->status.party_id);
+ struct party_data* p = party->search(sd->status.party_id);
int i;
if (!p) {
- iParty->request_info(sd->status.party_id, sd->status.char_id);
+ party->request_info(sd->status.party_id, sd->status.char_id);
return;
}
ARR_FIND( 0, MAX_PARTY, i, p->party.member[i].account_id == sd->status.account_id && p->party.member[i].char_id == sd->status.char_id );
@@ -455,7 +455,7 @@ void party_member_joined(struct map_session_data *sd)
int party_member_added(int party_id,int account_id,int char_id, int flag)
{
struct map_session_data *sd = iMap->id2sd(account_id),*sd2;
- struct party_data *p = iParty->search(party_id);
+ struct party_data *p = party->search(party_id);
int i, j;
if(sd == NULL || sd->status.char_id != char_id || !sd->party_joining ) {
@@ -517,7 +517,7 @@ int party_removemember(struct map_session_data* sd, int account_id, char* name)
struct party_data *p;
int i;
- p = iParty->search(sd->status.party_id);
+ p = party->search(sd->status.party_id);
if( p == NULL )
return 0;
@@ -542,7 +542,7 @@ int party_leave(struct map_session_data *sd)
struct party_data *p;
int i;
- p = iParty->search(sd->status.party_id);
+ p = party->search(sd->status.party_id);
if( p == NULL )
return 0;
@@ -558,7 +558,7 @@ int party_leave(struct map_session_data *sd)
int party_member_withdraw(int party_id, int account_id, int char_id)
{
struct map_session_data* sd = iMap->id2sd(account_id);
- struct party_data* p = iParty->search(party_id);
+ struct party_data* p = party->search(party_id);
if( p ) {
int i;
@@ -589,7 +589,7 @@ int party_broken(int party_id)
struct party_data* p;
int i, j;
- p = iParty->search(party_id);
+ p = party->search(party_id);
if( p == NULL )
return 0;
@@ -623,7 +623,7 @@ int party_optionchanged(int party_id,int account_id,int exp,int item,int flag)
{
struct party_data *p;
struct map_session_data *sd=iMap->id2sd(account_id);
- if( (p=iParty->search(party_id))==NULL)
+ if( (p=party->search(party_id))==NULL)
return 0;
//Flag&1: Exp change denied. Flag&2: Item change denied.
@@ -656,7 +656,7 @@ bool party_changeleader(struct map_session_data *sd, struct map_session_data *ts
return false;
}
- if ((p = iParty->search(sd->status.party_id)) == NULL)
+ if ((p = party->search(sd->status.party_id)) == NULL)
return false;
ARR_FIND( 0, MAX_PARTY, mi, p->data[mi].sd == sd );
@@ -698,7 +698,7 @@ int party_recv_movemap(int party_id,int account_id,int char_id, unsigned short m
struct party_data* p;
int i;
- p = iParty->search(party_id);
+ p = party->search(party_id);
if( p == NULL )
return 0;
@@ -729,7 +729,7 @@ void party_send_movemap(struct map_session_data *sd)
intif_party_changemap(sd,1);
- p=iParty->search(sd->status.party_id);
+ p=party->search(sd->status.party_id);
if (!p) return;
if(sd->state.connect_new) {
@@ -767,7 +767,7 @@ int party_send_logout(struct map_session_data *sd)
return 0;
intif_party_changemap(sd,0);
- p=iParty->search(sd->status.party_id);
+ p=party->search(sd->status.party_id);
if(!p) return 0;
ARR_FIND( 0, MAX_PARTY, i, p->data[i].sd == sd );
@@ -784,7 +784,7 @@ int party_send_message(struct map_session_data *sd,const char *mes,int len)
if(sd->status.party_id==0)
return 0;
intif_party_message(sd->status.party_id,sd->status.account_id,mes,len);
- iParty->recv_message(sd->status.party_id,sd->status.account_id,mes,len);
+ party->recv_message(sd->status.party_id,sd->status.account_id,mes,len);
// Chat logging type 'P' / Party Chat
logs->chat(LOG_CHAT_PARTY, sd->status.party_id, sd->status.char_id, sd->status.account_id, mapindex_id2name(sd->mapindex), sd->bl.x, sd->bl.y, NULL, mes);
@@ -795,7 +795,7 @@ int party_send_message(struct map_session_data *sd,const char *mes,int len)
int party_recv_message(int party_id,int account_id,const char *mes,int len)
{
struct party_data *p;
- if( (p=iParty->search(party_id))==NULL)
+ if( (p=party->search(party_id))==NULL)
return 0;
clif->party_message(p,account_id,mes,len);
return 0;
@@ -807,7 +807,7 @@ int party_skill_check(struct map_session_data *sd, int party_id, uint16 skill_id
struct map_session_data *p_sd;
int i;
- if(!party_id || (p=iParty->search(party_id))==NULL)
+ if(!party_id || (p=party->search(party_id))==NULL)
return 0;
switch(skill_id) {
case TK_COUNTER: //Increase Triple Attack rate of Monks.
@@ -832,7 +832,7 @@ int party_skill_check(struct map_session_data *sd, int party_id, uint16 skill_id
switch(skill_id) {
case TK_COUNTER: //Increase Triple Attack rate of Monks.
if((p_sd->class_&MAPID_UPPERMASK) == MAPID_MONK
- && iPc->checkskill(p_sd,MO_TRIPLEATTACK)) {
+ && pc->checkskill(p_sd,MO_TRIPLEATTACK)) {
sc_start4(&p_sd->bl,SC_SKILLRATE_UP,100,MO_TRIPLEATTACK,
50+50*skill_lv, //+100/150/200% rate
0,0,skill->get_time(SG_FRIEND, 1));
@@ -841,9 +841,9 @@ int party_skill_check(struct map_session_data *sd, int party_id, uint16 skill_id
case MO_COMBOFINISH: //Increase Counter rate of Star Gladiators
if((p_sd->class_&MAPID_UPPERMASK) == MAPID_STAR_GLADIATOR
&& sd->sc.data[SC_READYCOUNTER]
- && iPc->checkskill(p_sd,SG_FRIEND)) {
+ && pc->checkskill(p_sd,SG_FRIEND)) {
sc_start4(&p_sd->bl,SC_SKILLRATE_UP,100,TK_COUNTER,
- 50+50*iPc->checkskill(p_sd,SG_FRIEND), //+100/150/200% rate
+ 50+50*pc->checkskill(p_sd,SG_FRIEND), //+100/150/200% rate
0,0,skill->get_time(SG_FRIEND, 1));
}
break;
@@ -948,15 +948,15 @@ int party_exp_share(struct party_data* p, struct block_list* src, unsigned int b
for (i = 0; i < c; i++) {
#ifdef RENEWAL_EXP
if( !(src && src->type == BL_MOB && ((TBL_MOB*)src)->db->mexp) ){
- int rate = iPc->level_penalty_mod(sd[i], (TBL_MOB*)src, 1);
+ int rate = pc->level_penalty_mod(sd[i], (TBL_MOB*)src, 1);
base_exp = (unsigned int)cap_value(base_exp_bonus * rate / 100, 1, UINT_MAX);
job_exp = (unsigned int)cap_value(job_exp_bonus * rate / 100, 1, UINT_MAX);
}
#endif
- iPc->gainexp(sd[i], src, base_exp, job_exp, false);
+ pc->gainexp(sd[i], src, base_exp, job_exp, false);
if (zeny) // zeny from mobs [Valaris]
- iPc->getzeny(sd[i],zeny,LOG_TYPE_PICKDROP_MONSTER,NULL);
+ pc->getzeny(sd[i],zeny,LOG_TYPE_PICKDROP_MONSTER,NULL);
}
return 0;
}
@@ -981,7 +981,7 @@ int party_share_loot(struct party_data* p, struct map_session_data* sd, struct i
if( (psd = p->data[i].sd) == NULL || sd->bl.m != psd->bl.m || pc_isdead(psd) || (battle_config.idle_no_share && pc_isidle(psd)) )
continue;
- if (iPc->additem(psd,item_data,item_data->amount,LOG_TYPE_PICKDROP_PLAYER))
+ if (pc->additem(psd,item_data,item_data->amount,LOG_TYPE_PICKDROP_PLAYER))
continue; //Chosen char can't pick up loot.
//Successful pick.
@@ -1003,7 +1003,7 @@ int party_share_loot(struct party_data* p, struct map_session_data* sd, struct i
}
while (count > 0) { //Pick a random member.
i = rnd()%count;
- if (iPc->additem(psd[i],item_data,item_data->amount,LOG_TYPE_PICKDROP_PLAYER))
+ if (pc->additem(psd[i],item_data,item_data->amount,LOG_TYPE_PICKDROP_PLAYER))
{ //Discard this receiver.
psd[i] = psd[count-1];
count--;
@@ -1017,7 +1017,7 @@ int party_share_loot(struct party_data* p, struct map_session_data* sd, struct i
if (!target) {
target = sd; //Give it to the char that picked it up
- if ((i=iPc->additem(sd,item_data,item_data->amount,LOG_TYPE_PICKDROP_PLAYER)))
+ if ((i=pc->additem(sd,item_data,item_data->amount,LOG_TYPE_PICKDROP_PLAYER)))
return i;
}
@@ -1036,7 +1036,7 @@ int party_send_dot_remove(struct map_session_data *sd)
// To use for Taekwon's "Fighting Chant"
// int c = 0;
-// party_foreachsamemap(iParty->sub_count, sd, 0, &c);
+// party_foreachsamemap(party->sub_count, sd, 0, &c);
int party_sub_count(struct block_list *bl, va_list ap)
{
struct map_session_data *sd = (TBL_PC *)bl;
@@ -1062,7 +1062,7 @@ int party_foreachsamemap(int (*func)(struct block_list*,va_list),struct map_sess
nullpo_ret(sd);
- if((p=iParty->search(sd->status.party_id))==NULL)
+ if((p=party->search(sd->status.party_id))==NULL)
return 0;
x0=sd->bl.x-range;
@@ -1110,10 +1110,16 @@ static struct party_booking_ad_info* create_party_booking_data(void)
return pb_ad;
}
+#ifndef PARTY_RECRUIT
void party_booking_register(struct map_session_data *sd, short level, short mapid, short* job)
+#else
+void party_booking_register(struct map_session_data *sd, short level, const char *notice)
+#endif
{
struct party_booking_ad_info *pb_ad;
- int i;
+#ifndef PARTY_RECRUIT
+ int i;
+#endif
pb_ad = (struct party_booking_ad_info*)idb_get(party_booking_db, sd->status.char_id);
@@ -1129,22 +1135,32 @@ void party_booking_register(struct map_session_data *sd, short level, short mapi
}
memcpy(pb_ad->charname,sd->status.name,NAME_LENGTH);
- pb_ad->starttime = (int)time(NULL);
- pb_ad->p_detail.level = level;
+ pb_ad->expiretime = (int)time(NULL);
+ pb_ad->p_detail.level = level;
+#ifndef PARTY_RECRUIT
pb_ad->p_detail.mapid = mapid;
for(i=0;i<PARTY_BOOKING_JOBS;i++)
if(job[i] != 0xFF)
pb_ad->p_detail.job[i] = job[i];
else pb_ad->p_detail.job[i] = -1;
+#else
+ safestrncpy(pb_ad->p_detail.notice, notice, PB_NOTICE_LENGTH);
+#endif
clif->PartyBookingRegisterAck(sd, 0);
clif->PartyBookingInsertNotify(sd, pb_ad); // Notice
}
+#ifndef PARTY_RECRUIT
void party_booking_update(struct map_session_data *sd, short* job)
+#else
+void party_booking_update(struct map_session_data *sd, const char *notice)
+#endif
{
+#ifndef PARTY_RECRUIT
int i;
+#endif
struct party_booking_ad_info *pb_ad;
pb_ad = (struct party_booking_ad_info*)idb_get(party_booking_db, sd->status.char_id);
@@ -1152,20 +1168,33 @@ void party_booking_update(struct map_session_data *sd, short* job)
if( pb_ad == NULL )
return;
- pb_ad->starttime = (int)time(NULL);// Update time.
+ pb_ad->expiretime = (int)time(NULL);// Update time.
+#ifndef PARTY_RECRUIT
for(i=0;i<PARTY_BOOKING_JOBS;i++)
if(job[i] != 0xFF)
pb_ad->p_detail.job[i] = job[i];
else pb_ad->p_detail.job[i] = -1;
+#else
+ if (notice != NULL) {
+ safestrncpy(pb_ad->p_detail.notice, notice, PB_NOTICE_LENGTH);
+ }
+#endif
clif->PartyBookingUpdateNotify(sd, pb_ad);
}
+#ifndef PARTY_RECRUIT
void party_booking_search(struct map_session_data *sd, short level, short mapid, short job, unsigned long lastindex, short resultcount)
+#else
+void party_booking_search(struct map_session_data *sd, short level, short mapid, unsigned long lastindex, short resultcount)
+#endif
{
struct party_booking_ad_info *pb_ad;
- int i, count=0;
+#ifndef PARTY_RECRUIT
+ int i;
+#endif
+ int count = 0;
struct party_booking_ad_info* result_list[PARTY_BOOKING_RESULTS];
bool more_result = false;
DBIterator* iter = db_iterator(party_booking_db);
@@ -1174,12 +1203,18 @@ void party_booking_search(struct map_session_data *sd, short level, short mapid,
for( pb_ad = dbi_first(iter); dbi_exists(iter); pb_ad = dbi_next(iter) )
{
+#ifndef PARTY_RECRUIT
if (pb_ad->index < lastindex || (level && (pb_ad->p_detail.level < level-15 || pb_ad->p_detail.level > level)))
continue;
+#else
+ if ((level && (pb_ad->p_detail.level < level-15 || pb_ad->p_detail.level > level)))
+ continue;
+#endif
if (count >= PARTY_BOOKING_RESULTS){
more_result = true;
break;
}
+#ifndef PARTY_RECRUIT
if (mapid == 0 && job == -1)
result_list[count] = pb_ad;
else if (mapid == 0) {
@@ -1190,6 +1225,9 @@ void party_booking_search(struct map_session_data *sd, short level, short mapid,
if (pb_ad->p_detail.mapid == mapid)
result_list[count] = pb_ad;
}
+#else
+ result_list[count] = pb_ad;
+#endif
if( result_list[count] )
{
count++;
@@ -1217,47 +1255,47 @@ bool party_booking_delete(struct map_session_data *sd)
* created by Susu
*-------------------------------------*/
void party_defaults(void) {
- iParty = &iParty_s;
+ party = &party_s;
/* funcs */
- iParty->do_init_party = do_init_party;
- iParty->do_final_party = do_final_party;
- iParty->search = party_search;
- iParty->searchname = party_searchname;
- iParty->getmemberid = party_getmemberid;
- iParty->getavailablesd = party_getavailablesd;
+ party->do_init_party = do_init_party;
+ party->do_final_party = do_final_party;
+ party->search = party_search;
+ party->searchname = party_searchname;
+ party->getmemberid = party_getmemberid;
+ party->getavailablesd = party_getavailablesd;
- iParty->create = party_create;
- iParty->created = party_created;
- iParty->request_info = party_request_info;
- iParty->invite = party_invite;
- iParty->member_joined = party_member_joined;
- iParty->member_added = party_member_added;
- iParty->leave = party_leave;
- iParty->removemember = party_removemember;
- iParty->member_withdraw = party_member_withdraw;
- iParty->reply_invite = party_reply_invite;
- iParty->recv_noinfo = party_recv_noinfo;
- iParty->recv_info = party_recv_info;
- iParty->recv_movemap = party_recv_movemap;
- iParty->broken = party_broken;
- iParty->optionchanged = party_optionchanged;
- iParty->changeoption = party_changeoption;
- iParty->changeleader = party_changeleader;
- iParty->send_movemap = party_send_movemap;
- iParty->send_levelup = party_send_levelup;
- iParty->send_logout = party_send_logout;
- iParty->send_message = party_send_message;
- iParty->recv_message = party_recv_message;
- iParty->skill_check = party_skill_check;
- iParty->send_xy_clear = party_send_xy_clear;
- iParty->exp_share = party_exp_share;
- iParty->share_loot = party_share_loot;
- iParty->send_dot_remove = party_send_dot_remove;
- iParty->sub_count = party_sub_count;
- iParty->booking_register = party_booking_register;
- iParty->booking_update = party_booking_update;
- iParty->booking_search = party_booking_search;
- iParty->booking_delete = party_booking_delete;
+ party->create = party_create;
+ party->created = party_created;
+ party->request_info = party_request_info;
+ party->invite = party_invite;
+ party->member_joined = party_member_joined;
+ party->member_added = party_member_added;
+ party->leave = party_leave;
+ party->removemember = party_removemember;
+ party->member_withdraw = party_member_withdraw;
+ party->reply_invite = party_reply_invite;
+ party->recv_noinfo = party_recv_noinfo;
+ party->recv_info = party_recv_info;
+ party->recv_movemap = party_recv_movemap;
+ party->broken = party_broken;
+ party->optionchanged = party_optionchanged;
+ party->changeoption = party_changeoption;
+ party->changeleader = party_changeleader;
+ party->send_movemap = party_send_movemap;
+ party->send_levelup = party_send_levelup;
+ party->send_logout = party_send_logout;
+ party->send_message = party_send_message;
+ party->recv_message = party_recv_message;
+ party->skill_check = party_skill_check;
+ party->send_xy_clear = party_send_xy_clear;
+ party->exp_share = party_exp_share;
+ party->share_loot = party_share_loot;
+ party->send_dot_remove = party_send_dot_remove;
+ party->sub_count = party_sub_count;
+ party->booking_register = party_booking_register;
+ party->booking_update = party_booking_update;
+ party->booking_search = party_booking_search;
+ party->booking_delete = party_booking_delete;
}
diff --git a/src/map/party.h b/src/map/party.h
index 9956c5b33..e1f2d3a3b 100644
--- a/src/map/party.h
+++ b/src/map/party.h
@@ -3,6 +3,7 @@
#ifndef _PARTY_H_
#define _PARTY_H_
#include "../common/mmo.h" // struct party
+#include "../config/core.h"
struct block_list;
struct map_session_data;
struct party;
@@ -33,6 +34,7 @@ struct party_data {
} state;
};
+#ifndef PARTY_RECRUIT
struct party_booking_detail {
short level;
short mapid;
@@ -42,9 +44,23 @@ struct party_booking_detail {
struct party_booking_ad_info {
unsigned long index;
char charname[NAME_LENGTH];
- long starttime;
+ long expiretime;
struct party_booking_detail p_detail;
};
+#else
+#define PB_NOTICE_LENGTH (36 + 1)
+struct party_booking_detail {
+ short level;
+ char notice[PB_NOTICE_LENGTH];
+};
+
+struct party_booking_ad_info {
+ unsigned long index;
+ long expiretime;
+ char charname[NAME_LENGTH];
+ struct party_booking_detail p_detail;
+};
+#endif
int party_foreachsamemap(int (*func)(struct block_list *,va_list),struct map_session_data *sd,int range,...);
@@ -97,13 +113,19 @@ struct party_interface {
int (*share_loot) (struct party_data* p, struct map_session_data* sd, struct item* item_data, int first_charid);
int (*send_dot_remove) (struct map_session_data *sd);
int (*sub_count) (struct block_list *bl, va_list ap);
+#ifndef PARTY_RECRUIT
void (*booking_register) (struct map_session_data *sd, short level, short mapid, short* job);
void (*booking_update) (struct map_session_data *sd, short* job);
void (*booking_search) (struct map_session_data *sd, short level, short mapid, short job, unsigned long lastindex, short resultcount);
+#else
+ void (*booking_register) (struct map_session_data *sd, short level, const char *notice);
+ void (*booking_update) (struct map_session_data *sd, const char *notice);
+ void (*booking_search) (struct map_session_data *sd, short level, short mapid, unsigned long lastindex, short resultcount);
+#endif
bool (*booking_delete) (struct map_session_data *sd);
-} iParty_s;
+} party_s;
-struct party_interface *iParty;
+struct party_interface *party;
void party_defaults(void);
diff --git a/src/map/path.c b/src/map/path.c
index 8ab63d390..95895cb2a 100644
--- a/src/map/path.c
+++ b/src/map/path.c
@@ -419,7 +419,7 @@ bool path_search(struct walkpath_data *wpd,int16 m,int16 x0,int16 y0,int16 x1,in
}
-//Distance functions, taken from http://www.flipcode.com/articles/article_fastdistance.shtml
+//Distance functions, taken from http://www.flpcode.com/articles/article_fastdistance.shtml
int check_distance(int dx, int dy, int distance)
{
#ifdef CIRCULAR_AREA
diff --git a/src/map/pc.c b/src/map/pc.c
index b5d5e3140..170de63ff 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -33,7 +33,7 @@
#include "elemental.h"
#include "npc.h" // fake_nd
#include "pet.h" // pet_unlocktarget()
-#include "party.h" // iParty->search()
+#include "party.h" // party->search()
#include "guild.h" // guild->search(), guild_request_info()
#include "script.h" // script_config
#include "skill.h"
@@ -424,7 +424,7 @@ static int pc_inventory_rental_end(int tid, unsigned int tick, int id, intptr_t
return 0;
}
- iPc->inventory_rentals(sd);
+ pc->inventory_rentals(sd);
return 1;
}
@@ -457,7 +457,7 @@ void pc_inventory_rentals(struct map_session_data *sd)
status_change_end(&sd->bl,SC_ALL_RIDING,INVALID_TIMER);
}
clif->rental_expired(sd->fd, i, sd->status.inventory[i].nameid);
- iPc->delitem(sd, i, sd->status.inventory[i].amount, 0, 0, LOG_TYPE_OTHER);
+ pc->delitem(sd, i, sd->status.inventory[i].amount, 0, 0, LOG_TYPE_OTHER);
} else {
expire_tick = (unsigned int)(sd->status.inventory[i].expire_time - time(NULL)) * 1000;
clif->rental_time(sd->fd, sd->status.inventory[i].nameid, (int)(expire_tick / 1000));
@@ -485,7 +485,7 @@ void pc_inventory_rental_add(struct map_session_data *sd, int seconds)
td = iTimer->get_timer(sd->rental_timer);
if( DIFF_TICK(td->tick, iTimer->gettick()) > tick )
{ // Update Timer as this one ends first than the current one
- iPc->inventory_rental_clear(sd);
+ pc->inventory_rental_clear(sd);
sd->rental_timer = iTimer->add_timer(iTimer->gettick() + tick, pc_inventory_rental_end, sd->bl.id, 0);
}
}
@@ -520,7 +520,7 @@ int pc_makesavestatus(struct map_session_data *sd)
#endif
if (sd->sc.data[SC_JAILED]) { //When Jailed, do not move last point.
if(pc_isdead(sd)){
- iPc->setrestartvalue(sd,0);
+ pc->setrestartvalue(sd,0);
} else {
sd->status.hp = sd->battle_status.hp;
sd->status.sp = sd->battle_status.sp;
@@ -532,7 +532,7 @@ int pc_makesavestatus(struct map_session_data *sd)
}
if(pc_isdead(sd)){
- iPc->setrestartvalue(sd,0);
+ pc->setrestartvalue(sd,0);
memcpy(&sd->status.last_point,&sd->status.save_point,sizeof(sd->status.last_point));
} else {
sd->status.hp = sd->battle_status.hp;
@@ -603,7 +603,7 @@ int pc_equippoint(struct map_session_data *sd,int n)
if(sd->inventory_data[n]->look == W_DAGGER ||
sd->inventory_data[n]->look == W_1HSWORD ||
sd->inventory_data[n]->look == W_1HAXE) {
- if(ep == EQP_HAND_R && (iPc->checkskill(sd,AS_LEFT) > 0 || (sd->class_&MAPID_UPPERMASK) == MAPID_ASSASSIN ||
+ if(ep == EQP_HAND_R && (pc->checkskill(sd,AS_LEFT) > 0 || (sd->class_&MAPID_UPPERMASK) == MAPID_ASSASSIN ||
(sd->class_&MAPID_UPPERMASK) == MAPID_KAGEROUOBORO))//Kagerou and Oboro can dual wield daggers. [Rytech]
return EQP_ARMS;
}
@@ -768,10 +768,10 @@ bool pc_can_Adopt(struct map_session_data *p1_sd, struct map_session_data *p2_sd
return false; // Both parents need to be in the same party
// Parents need to have their ring equipped
- if( !iPc->isequipped(p1_sd, WEDDING_RING_M) && !iPc->isequipped(p1_sd, WEDDING_RING_F) )
+ if( !pc->isequipped(p1_sd, WEDDING_RING_M) && !pc->isequipped(p1_sd, WEDDING_RING_F) )
return false;
- if( !iPc->isequipped(p2_sd, WEDDING_RING_M) && !iPc->isequipped(p2_sd, WEDDING_RING_F) )
+ if( !pc->isequipped(p2_sd, WEDDING_RING_M) && !pc->isequipped(p2_sd, WEDDING_RING_F) )
return false;
// Already adopted a baby
@@ -805,15 +805,15 @@ bool pc_adoption(struct map_session_data *p1_sd, struct map_session_data *p2_sd,
int job, joblevel;
unsigned int jobexp;
- if( !iPc->can_Adopt(p1_sd, p2_sd, b_sd) )
+ if( !pc->can_Adopt(p1_sd, p2_sd, b_sd) )
return false;
// Preserve current job levels and progress
joblevel = b_sd->status.job_level;
jobexp = b_sd->status.job_exp;
- job = iPc->mapid2jobid(b_sd->class_|JOBL_BABY, b_sd->status.sex);
- if( job != -1 && !iPc->jobchange(b_sd, job, 0) )
+ job = pc->mapid2jobid(b_sd->class_|JOBL_BABY, b_sd->status.sex);
+ if( job != -1 && !pc->jobchange(b_sd, job, 0) )
{ // Success, proceed to configure parents and baby skills
p1_sd->status.child = b_sd->status.char_id;
p2_sd->status.child = b_sd->status.char_id;
@@ -827,12 +827,12 @@ bool pc_adoption(struct map_session_data *p1_sd, struct map_session_data *p2_sd,
clif->updatestatus(b_sd, SP_JOBEXP);
// Baby Skills
- iPc->skill(b_sd, WE_BABY, 1, 0);
- iPc->skill(b_sd, WE_CALLPARENT, 1, 0);
+ pc->skill(b_sd, WE_BABY, 1, 0);
+ pc->skill(b_sd, WE_CALLPARENT, 1, 0);
// Parents Skills
- iPc->skill(p1_sd, WE_CALLBABY, 1, 0);
- iPc->skill(p2_sd, WE_CALLBABY, 1, 0);
+ pc->skill(p1_sd, WE_CALLBABY, 1, 0);
+ pc->skill(p2_sd, WE_CALLBABY, 1, 0);
return true;
}
@@ -935,7 +935,7 @@ bool pc_authok(struct map_session_data *sd, int login_id2, time_t expiration_tim
}
//Set the map-server used job id. [Skotlex]
- i = iPc->jobid2mapid(sd->status.class_);
+ i = pc->jobid2mapid(sd->status.class_);
if (i == -1) { //Invalid class?
ShowError("pc_authok: Invalid class %d for player %s (%d:%d). Class was changed to novice.\n", sd->status.class_, sd->status.name, sd->status.account_id, sd->status.char_id);
sd->status.class_ = JOB_NOVICE;
@@ -1005,10 +1005,10 @@ bool pc_authok(struct map_session_data *sd, int login_id2, time_t expiration_tim
if (!(battle_config.display_skill_fail&2))
sd->state.showdelay = 1;
- iPc->setinventorydata(sd);
+ pc->setinventorydata(sd);
pc_setequipindex(sd);
- if( sd->status.option & OPTION_INVISIBLE && !iPc->can_use_command(sd, "@hide") )
+ if( sd->status.option & OPTION_INVISIBLE && !pc->can_use_command(sd, "@hide") )
sd->status.option &=~ OPTION_INVISIBLE;
status_change_init(&sd->bl);
@@ -1047,11 +1047,11 @@ bool pc_authok(struct map_session_data *sd, int login_id2, time_t expiration_tim
sd->hate_mob[i] = -1;
//warp player
- if ((i=iPc->setpos(sd,sd->status.last_point.map, sd->status.last_point.x, sd->status.last_point.y, CLR_OUTSIGHT)) != 0) {
+ if ((i=pc->setpos(sd,sd->status.last_point.map, sd->status.last_point.x, sd->status.last_point.y, CLR_OUTSIGHT)) != 0) {
ShowError ("Last_point_map %s - id %d not found (error code %d)\n", mapindex_id2name(sd->status.last_point.map), sd->status.last_point.map, i);
// try warping to a default map instead (church graveyard)
- if (iPc->setpos(sd, mapindex_name2id(MAP_PRONTERA), 273, 354, CLR_OUTSIGHT) != 0) {
+ if (pc->setpos(sd, mapindex_name2id(MAP_PRONTERA), 273, 354, CLR_OUTSIGHT) != 0) {
// if we fail again
clif->authfail_fd(sd->fd, 0);
return false;
@@ -1109,7 +1109,7 @@ bool pc_authok(struct map_session_data *sd, int login_id2, time_t expiration_tim
/**
* Check if player have any item cooldowns on
**/
- iPc->itemcd_do(sd,true);
+ pc->itemcd_do(sd,true);
/* [Ind/Hercules] */
sd->sc_display = NULL;
@@ -1191,7 +1191,7 @@ int pc_reg_received(struct map_session_data *sd)
sd->hate_mob[i] = pc_readglobalreg(sd,sg_info[i].hate_var)-1;
}
- if ((i = iPc->checkskill(sd,RG_PLAGIARISM)) > 0) {
+ if ((i = pc->checkskill(sd,RG_PLAGIARISM)) > 0) {
sd->cloneskill_id = pc_readglobalreg(sd,"CLONE_SKILL");
if (sd->cloneskill_id > 0 && (idx = skill->get_index(sd->cloneskill_id))) {
sd->status.skill[idx].id = sd->cloneskill_id;
@@ -1201,7 +1201,7 @@ int pc_reg_received(struct map_session_data *sd)
sd->status.skill[idx].flag = SKILL_FLAG_PLAGIARIZED;
}
}
- if ((i = iPc->checkskill(sd,SC_REPRODUCE)) > 0) {
+ if ((i = pc->checkskill(sd,SC_REPRODUCE)) > 0) {
sd->reproduceskill_id = pc_readglobalreg(sd,"REPRODUCE_SKILL");
if( sd->reproduceskill_id > 0 && (idx = skill->get_index(sd->reproduceskill_id))) {
sd->status.skill[idx].id = sd->reproduceskill_id;
@@ -1217,7 +1217,7 @@ int pc_reg_received(struct map_session_data *sd)
sd->state.active = 1;
if (sd->status.party_id)
- iParty->member_joined(sd);
+ party->member_joined(sd);
if (sd->status.guild_id)
guild->member_joined(sd);
@@ -1238,7 +1238,7 @@ int pc_reg_received(struct map_session_data *sd)
if (!chrif_auth_finished(sd))
ShowError("pc_reg_received: Failed to properly remove player %d:%d from logging db!\n", sd->status.account_id, sd->status.char_id);
- iPc->load_combo(sd);
+ pc->load_combo(sd);
status_calc_pc(sd,1);
chrif_scdata_request(sd->status.account_id, sd->status.char_id);
@@ -1251,7 +1251,7 @@ int pc_reg_received(struct map_session_data *sd)
clif->pLoadEndAck(sd->fd, sd);
}
- iPc->inventory_rentals(sd);
+ pc->inventory_rentals(sd);
if( sd->sc.option & OPTION_INVISIBLE ) {
sd->vd.class_ = INVISIBLE_CLASS;
@@ -1260,7 +1260,7 @@ int pc_reg_received(struct map_session_data *sd)
map[sd->bl.m].users_pvp--;
if( map[sd->bl.m].flag.pvp && !map[sd->bl.m].flag.pvp_nocalcrank && sd->pvp_timer != INVALID_TIMER ) {// unregister the player for ranking
- iTimer->delete_timer( sd->pvp_timer, iPc->calc_pvprank_timer );
+ iTimer->delete_timer( sd->pvp_timer, pc->calc_pvprank_timer );
sd->pvp_timer = INVALID_TIMER;
}
clif->changeoption(&sd->bl);
@@ -1279,7 +1279,7 @@ static int pc_calc_skillpoint(struct map_session_data* sd)
nullpo_ret(sd);
for(i=1;i<MAX_SKILL;i++){
- if( (skill_lv = iPc->checkskill2(sd,i)) > 0) {
+ if( (skill_lv = pc->checkskill2(sd,i)) > 0) {
inf2 = skill_db[i].inf2;
if((!(inf2&INF2_QUEST_SKILL) || battle_config.quest_skill_learn) &&
!(inf2&(INF2_WEDDING_SKILL|INF2_SPIRIT_SKILL)) //Do not count wedding/link skills. [Skotlex]
@@ -1305,14 +1305,14 @@ int pc_calc_skilltree(struct map_session_data *sd)
int c=0;
nullpo_ret(sd);
- i = iPc->calc_skilltree_normalize_job(sd);
- c = iPc->mapid2jobid(i, sd->status.sex);
+ i = pc->calc_skilltree_normalize_job(sd);
+ c = pc->mapid2jobid(i, sd->status.sex);
if( c == -1 )
{ //Unable to normalize job??
ShowError("pc_calc_skilltree: Unable to normalize job %d for character %s (%d:%d)\n", i, sd->status.name, sd->status.account_id, sd->status.char_id);
return 1;
}
- c = iPc->class2idx(c);
+ c = pc->class2idx(c);
for( i = 0; i < MAX_SKILL; i++ ) {
if( sd->status.skill[i].flag != SKILL_FLAG_PLAGIARIZED && sd->status.skill[i].flag != SKILL_FLAG_PERM_GRANTED ) //Don't touch these
@@ -1410,7 +1410,7 @@ int pc_calc_skilltree(struct map_session_data *sd)
else if (sd->status.skill[idx2].flag >= SKILL_FLAG_REPLACED_LV_0) //Real lerned level
k = sd->status.skill[idx2].flag - SKILL_FLAG_REPLACED_LV_0;
else
- k = iPc->checkskill2(sd,idx2);
+ k = pc->checkskill2(sd,idx2);
if (k < skill_tree[c][i].need[j].lv) {
f = 0;
break;
@@ -1443,7 +1443,7 @@ int pc_calc_skilltree(struct map_session_data *sd)
} while(flag);
//
- if( c > 0 && (sd->class_&MAPID_UPPERMASK) == MAPID_TAEKWON && sd->status.base_level >= 90 && sd->status.skill_point == 0 && iPc->famerank(sd->status.char_id, MAPID_TAEKWON) )
+ if( c > 0 && (sd->class_&MAPID_UPPERMASK) == MAPID_TAEKWON && sd->status.base_level >= 90 && sd->status.skill_point == 0 && pc->famerank(sd->status.char_id, MAPID_TAEKWON) )
{
/* Taekwon Ranger Bonus Skill Tree
============================================
@@ -1479,13 +1479,13 @@ static void pc_check_skilltree(struct map_session_data *sd, int skill_id)
if(battle_config.skillfree)
return; //Function serves no purpose if this is set
- i = iPc->calc_skilltree_normalize_job(sd);
- c = iPc->mapid2jobid(i, sd->status.sex);
+ i = pc->calc_skilltree_normalize_job(sd);
+ c = pc->mapid2jobid(i, sd->status.sex);
if (c == -1) { //Unable to normalize job??
ShowError("pc_check_skilltree: Unable to normalize job %d for character %s (%d:%d)\n", i, sd->status.name, sd->status.account_id, sd->status.char_id);
return;
}
- c = iPc->class2idx(c);
+ c = pc->class2idx(c);
do {
flag = 0;
for( i = 0; i < MAX_SKILL_TREE && (id=skill_tree[c][i].id)>0; i++ ) {
@@ -1502,7 +1502,7 @@ static void pc_check_skilltree(struct map_session_data *sd, int skill_id)
else if( sd->status.skill[idx2].flag >= SKILL_FLAG_REPLACED_LV_0) //Real lerned level
k = sd->status.skill[idx2].flag - SKILL_FLAG_REPLACED_LV_0;
else
- k = iPc->checkskill2(sd,idx2);
+ k = pc->checkskill2(sd,idx2);
if( k < skill_tree[c][i].need[j].lv ) {
f = 0;
break;
@@ -1557,7 +1557,7 @@ int pc_calc_skilltree_normalize_job(struct map_session_data *sd)
skill_point = pc_calc_skillpoint(sd);
- novice_skills = max_level[iPc->class2idx(JOB_NOVICE)][1] - 1;
+ novice_skills = max_level[pc->class2idx(JOB_NOVICE)][1] - 1;
// limit 1st class and above to novice job levels
if(skill_point < novice_skills)
@@ -1574,7 +1574,7 @@ int pc_calc_skilltree_normalize_job(struct map_session_data *sd)
{
// if neither 2nd nor 3rd jobchange levels are known, we have to assume a default for 2nd
if (!sd->change_level_3rd)
- sd->change_level_2nd = max_level[iPc->class2idx(iPc->mapid2jobid(sd->class_&MAPID_UPPERMASK, sd->status.sex))][1];
+ sd->change_level_2nd = max_level[pc->class2idx(pc->mapid2jobid(sd->class_&MAPID_UPPERMASK, sd->status.sex))][1];
else
sd->change_level_2nd = 1 + skill_point + sd->status.skill_point
- (sd->status.job_level - 1)
@@ -1913,7 +1913,7 @@ int pc_delautobonus(struct map_session_data* sd, struct s_autobonus *autobonus,c
}
else
{ // Logout / Unequipped an item with an activated bonus
- iTimer->delete_timer(autobonus[i].active,iPc->endautobonus);
+ iTimer->delete_timer(autobonus[i].active,pc->endautobonus);
autobonus[i].active = INVALID_TIMER;
}
}
@@ -1941,7 +1941,7 @@ int pc_exeautobonus(struct map_session_data *sd,struct s_autobonus *autobonus)
script_run_autobonus(autobonus->other_script,sd->bl.id,sd->equip_index[j]);
}
- autobonus->active = iTimer->add_timer(iTimer->gettick()+autobonus->duration, iPc->endautobonus, sd->bl.id, (intptr_t)autobonus);
+ autobonus->active = iTimer->add_timer(iTimer->gettick()+autobonus->duration, pc->endautobonus, sd->bl.id, (intptr_t)autobonus);
sd->state.autobonus |= autobonus->pos;
status_calc_pc(sd,0);
@@ -3556,7 +3556,7 @@ int pc_insert_card(struct map_session_data* sd, int idx_card, int idx_equip)
// remember the card id to insert
nameid = sd->status.inventory[idx_card].nameid;
- if( iPc->delitem(sd,idx_card,1,1,0,LOG_TYPE_OTHER) == 1 )
+ if( pc->delitem(sd,idx_card,1,1,0,LOG_TYPE_OTHER) == 1 )
{// failed
clif->insert_card(sd,idx_equip,idx_card,1);
}
@@ -3581,9 +3581,9 @@ int pc_insert_card(struct map_session_data* sd, int idx_card, int idx_equip)
int pc_modifybuyvalue(struct map_session_data *sd,int orig_value)
{
int skill,val = orig_value,rate1 = 0,rate2 = 0;
- if((skill=iPc->checkskill(sd,MC_DISCOUNT))>0) // merchant discount
+ if((skill=pc->checkskill(sd,MC_DISCOUNT))>0) // merchant discount
rate1 = 5+skill*2-((skill==10)? 1:0);
- if((skill=iPc->checkskill(sd,RG_COMPULSION))>0) // rogue discount
+ if((skill=pc->checkskill(sd,RG_COMPULSION))>0) // rogue discount
rate2 = 5+skill*4;
if(rate1 < rate2) rate1 = rate2;
if(rate1)
@@ -3600,7 +3600,7 @@ int pc_modifybuyvalue(struct map_session_data *sd,int orig_value)
int pc_modifysellvalue(struct map_session_data *sd,int orig_value)
{
int skill,val = orig_value,rate = 0;
- if((skill=iPc->checkskill(sd,MC_OVERCHARGE))>0) //OverCharge
+ if((skill=pc->checkskill(sd,MC_OVERCHARGE))>0) //OverCharge
rate = 5+skill*2-((skill==10)? 1:0);
if(rate)
val = (int)((double)orig_value*(double)(100+rate)/100.);
@@ -3889,7 +3889,7 @@ int pc_additem(struct map_session_data *sd,struct item *item_data,int amount,e_l
if( i >= MAX_INVENTORY )
{
- i = iPc->search_inventory(sd,0);
+ i = pc->search_inventory(sd,0);
if( i < 0 )
return 4;
@@ -3912,17 +3912,17 @@ int pc_additem(struct map_session_data *sd,struct item *item_data,int amount,e_l
clif->updatestatus(sd,SP_WEIGHT);
//Auto-equip
if(data->flag.autoequip)
- iPc->equipitem(sd, i, data->equip);
+ pc->equipitem(sd, i, data->equip);
/* rental item check */
if( item_data->expire_time ) {
if( time(NULL) > item_data->expire_time ) {
clif->rental_expired(sd->fd, i, sd->status.inventory[i].nameid);
- iPc->delitem(sd, i, sd->status.inventory[i].amount, 1, 0, LOG_TYPE_OTHER);
+ pc->delitem(sd, i, sd->status.inventory[i].amount, 1, 0, LOG_TYPE_OTHER);
} else {
int seconds = (int)( item_data->expire_time - time(NULL) );
clif->rental_time(sd->fd, sd->status.inventory[i].nameid, seconds);
- iPc->inventory_rental_add(sd, seconds);
+ pc->inventory_rental_add(sd, seconds);
}
}
@@ -3952,7 +3952,7 @@ int pc_delitem(struct map_session_data *sd,int n,int amount,int type, short reas
sd->weight -= sd->inventory_data[n]->weight*amount ;
if( sd->status.inventory[n].amount <= 0 ){
if(sd->status.inventory[n].equip)
- iPc->unequipitem(sd,n,3);
+ pc->unequipitem(sd,n,3);
memset(&sd->status.inventory[n],0,sizeof(sd->status.inventory[0]));
sd->inventory_data[n] = NULL;
}
@@ -3984,7 +3984,7 @@ int pc_dropitem(struct map_session_data *sd,int n,int amount)
sd->status.inventory[n].amount <= 0 ||
sd->status.inventory[n].amount < amount ||
sd->state.trading || sd->state.vending ||
- !sd->inventory_data[n] //iPc->delitem would fail on this case.
+ !sd->inventory_data[n] //pc->delitem would fail on this case.
)
return 0;
@@ -3994,7 +3994,7 @@ int pc_dropitem(struct map_session_data *sd,int n,int amount)
return 0; //Can't drop items in nodrop mapflag maps.
}
- if( !iPc->candrop(sd,&sd->status.inventory[n]) )
+ if( !pc->candrop(sd,&sd->status.inventory[n]) )
{
clif->message (sd->fd, msg_txt(263));
return 0;
@@ -4003,7 +4003,7 @@ int pc_dropitem(struct map_session_data *sd,int n,int amount)
if (!iMap->addflooritem(&sd->status.inventory[n], amount, sd->bl.m, sd->bl.x, sd->bl.y, 0, 0, 0, 2))
return 0;
- iPc->delitem(sd, n, amount, 1, 0, LOG_TYPE_PICKDROP_PLAYER);
+ pc->delitem(sd, n, amount, 1, 0, LOG_TYPE_PICKDROP_PLAYER);
clif->dropitem(sd, n, amount);
return 1;
}
@@ -4028,7 +4028,7 @@ int pc_takeitem(struct map_session_data *sd,struct flooritem_data *fitem)
return 0; // Distance is too far
if (sd->status.party_id)
- p = iParty->search(sd->status.party_id);
+ p = party->search(sd->status.party_id);
if(fitem->first_get_charid > 0 && fitem->first_get_charid != sd->status.char_id)
{
@@ -4067,7 +4067,7 @@ int pc_takeitem(struct map_session_data *sd,struct flooritem_data *fitem)
}
//This function takes care of giving the item to whoever should have it, considering party-share options.
- if ((flag = iParty->share_loot(p,sd,&fitem->item_data, fitem->first_get_charid))) {
+ if ((flag = party->share_loot(p,sd,&fitem->item_data, fitem->first_get_charid))) {
clif->additem(sd,0,0,flag);
return 1;
}
@@ -4103,7 +4103,7 @@ int pc_isUseitem(struct map_session_data *sd,int n)
if( !item->script ) //if it has no script, you can't really consume it!
return 0;
- if( (item->item_usage.flag&NOUSE_SITTING) && (pc_issit(sd) == 1) && (iPc->get_group_level(sd) < item->item_usage.override) ) {
+ if( (item->item_usage.flag&NOUSE_SITTING) && (pc_issit(sd) == 1) && (pc->get_group_level(sd) < item->item_usage.override) ) {
clif->msgtable(sd->fd,664);
//clif->colormes(sd->fd,COLOR_WHITE,msg_txt(1474));
return 0; // You cannot use this item while sitting.
@@ -4268,7 +4268,7 @@ int pc_useitem(struct map_session_data *sd,int n)
if( !pc_isUseitem(sd,n) )
return 0;
- // Store information for later use before it is lost (via iPc->delitem) [Paradox924X]
+ // Store information for later use before it is lost (via pc->delitem) [Paradox924X]
nameid = sd->inventory_data[n]->nameid;
if (nameid != ITEMID_NAUTHIZ && sd->sc.opt1 > 0 && sd->sc.opt1 != OPT1_STONEWAIT && sd->sc.opt1 != OPT1_BURNING)
@@ -4348,7 +4348,7 @@ int pc_useitem(struct map_session_data *sd,int n)
if( map[sd->bl.m].zone->disabled_items[i] == nameid ) {
if( battle_config.item_restricted_consumption_type ) {
clif->useitemack(sd,n,sd->status.inventory[n].amount-1,true);
- iPc->delitem(sd,n,1,1,0,LOG_TYPE_CONSUME);
+ pc->delitem(sd,n,1,1,0,LOG_TYPE_CONSUME);
}
return 0;
}
@@ -4367,12 +4367,12 @@ int pc_useitem(struct map_session_data *sd,int n)
else {
if( sd->status.inventory[n].expire_time == 0 ) {
clif->useitemack(sd,n,amount-1,true);
- iPc->delitem(sd,n,1,1,0,LOG_TYPE_CONSUME); // Rental Usable Items are not deleted until expiration
+ pc->delitem(sd,n,1,1,0,LOG_TYPE_CONSUME); // Rental Usable Items are not deleted until expiration
} else
clif->useitemack(sd,n,0,false);
}
if(sd->status.inventory[n].card[0]==CARD0_CREATE &&
- iPc->famerank(MakeDWord(sd->status.inventory[n].card[2],sd->status.inventory[n].card[3]), MAPID_ALCHEMIST))
+ pc->famerank(MakeDWord(sd->status.inventory[n].card[2],sd->status.inventory[n].card[3]), MAPID_ALCHEMIST))
{
potion_flag = 2; // Famous player's potions have 50% more efficiency
if (sd->sc.data[SC_SPIRIT] && sd->sc.data[SC_SPIRIT]->val2 == SL_ROGUE)
@@ -4412,7 +4412,7 @@ int pc_cart_additem(struct map_session_data *sd,struct item *item_data,int amoun
return 1;
}
- if( !itemdb_cancartstore(item_data, iPc->get_group_level(sd)) )
+ if( !itemdb_cancartstore(item_data, pc->get_group_level(sd)) )
{ // Check item trade restrictions [Skotlex]
clif->message (sd->fd, msg_txt(264));
return 1;
@@ -4507,8 +4507,8 @@ int pc_putitemtocart(struct map_session_data *sd,int idx,int amount)
if( item_data->nameid == 0 || amount < 1 || item_data->amount < amount || sd->state.vending )
return 1;
- if( iPc->cart_additem(sd,item_data,amount,LOG_TYPE_NONE) == 0 )
- return iPc->delitem(sd,idx,amount,0,5,LOG_TYPE_NONE);
+ if( pc->cart_additem(sd,item_data,amount,LOG_TYPE_NONE) == 0 )
+ return pc->delitem(sd,idx,amount,0,5,LOG_TYPE_NONE);
return 1;
}
@@ -4535,7 +4535,7 @@ int pc_cartitem_amount(struct map_session_data* sd, int idx, int amount)
/*==========================================
* Retrieve an item at index idx from cart.
* Return:
- * 0 = player not found or (FIXME) succes (from iPc->cart_delitem)
+ * 0 = player not found or (FIXME) succes (from pc->cart_delitem)
* 1 = failure
*------------------------------------------*/
int pc_getitemfromcart(struct map_session_data *sd,int idx,int amount)
@@ -4552,8 +4552,8 @@ int pc_getitemfromcart(struct map_session_data *sd,int idx,int amount)
if(item_data->nameid==0 || amount < 1 || item_data->amount<amount || sd->state.vending )
return 1;
- if((flag = iPc->additem(sd,item_data,amount,LOG_TYPE_NONE)) == 0)
- return iPc->cart_delitem(sd,idx,amount,0,LOG_TYPE_NONE);
+ if((flag = pc->additem(sd,item_data,amount,LOG_TYPE_NONE)) == 0)
+ return pc->cart_delitem(sd,idx,amount,0,LOG_TYPE_NONE);
clif->additem(sd,0,0,flag);
return 1;
@@ -4636,7 +4636,7 @@ int pc_steal_item(struct map_session_data *sd,struct block_list *bl, uint16 skil
tmp_item.nameid = itemid;
tmp_item.amount = 1;
tmp_item.identify = itemdb_isidentified2(data);
- flag = iPc->additem(sd,&tmp_item,1,LOG_TYPE_PICKDROP_PLAYER);
+ flag = pc->additem(sd,&tmp_item,1,LOG_TYPE_PICKDROP_PLAYER);
//TODO: Should we disable stealing when the item you stole couldn't be added to your inventory? Perhaps players will figure out a way to exploit this behaviour otherwise?
md->state.steal_flag = UCHAR_MAX; //you can't steal from this mob any more
@@ -4683,13 +4683,13 @@ int pc_steal_coin(struct map_session_data *sd,struct block_list *target)
return 0;
// FIXME: This formula is either custom or outdated.
- skill = iPc->checkskill(sd,RG_STEALCOIN)*10;
+ skill = pc->checkskill(sd,RG_STEALCOIN)*10;
rate = skill + (sd->status.base_level - md->level)*3 + sd->battle_status.dex*2 + sd->battle_status.luk*2;
if(rnd()%1000 < rate)
{
int amount = md->level*10 + rnd()%100;
- iPc->getzeny(sd, amount, LOG_TYPE_STEAL, NULL);
+ pc->getzeny(sd, amount, LOG_TYPE_STEAL, NULL);
md->state.steal_coin_flag = 1;
return 1;
}
@@ -4714,8 +4714,8 @@ int pc_setpos(struct map_session_data* sd, unsigned short mapindex, int x, int y
}
if( pc_isdead(sd) ) { //Revive dead people before warping them
- iPc->setstand(sd);
- iPc->setrestartvalue(sd,1);
+ pc->setstand(sd);
+ pc->setrestartvalue(sd,1);
}
m = iMap->mapindex2mapid(mapindex);
@@ -4736,7 +4736,7 @@ int pc_setpos(struct map_session_data* sd, unsigned short mapindex, int x, int y
stop = true;
}
}
- if ( !stop && sd->status.party_id && (p = iParty->search(sd->status.party_id)) && p->instances ) {
+ if ( !stop && sd->status.party_id && (p = party->search(sd->status.party_id)) && p->instances ) {
for( i = 0; i < p->instances; i++ ) {
ARR_FIND(0, instances[p->instance[i]].num_map, j, map[instances[p->instance[i]].map[j]].instance_src_map == m && !map[instances[p->instance[i]].map[j]].cName);
if( j != instances[p->instance[i]].num_map )
@@ -4771,7 +4771,7 @@ int pc_setpos(struct map_session_data* sd, unsigned short mapindex, int x, int y
for( i = 0; i < sd->queues_count; i++ ) {
struct hQueue *queue;
if( (queue = script->queue(sd->queues[i])) && queue->onMapChange[0] != '\0' ) {
- iPc->setregstr(sd, add_str("QMapChangeTo"), map[m].name);
+ pc->setregstr(sd, add_str("QMapChangeTo"), map[m].name);
npc_event(sd, queue->onMapChange, 0);
}
}
@@ -4799,12 +4799,12 @@ int pc_setpos(struct map_session_data* sd, unsigned short mapindex, int x, int y
}
for( i = 0; i < EQI_MAX; i++ ) {
if( sd->equip_index[ i ] >= 0 )
- if( !iPc->isequip( sd , sd->equip_index[ i ] ) )
- iPc->unequipitem( sd , sd->equip_index[ i ] , 2 );
+ if( !pc->isequip( sd , sd->equip_index[ i ] ) )
+ pc->unequipitem( sd , sd->equip_index[ i ] , 2 );
}
if (battle_config.clear_unit_onwarp&BL_PC)
skill->clear_unitgroup(&sd->bl);
- iParty->send_dot_remove(sd); //minimap dot fix [Kevin]
+ party->send_dot_remove(sd); //minimap dot fix [Kevin]
guild->send_dot_remove(sd);
bg_send_dot_remove(sd);
if (sd->regen.state.gc)
@@ -4836,7 +4836,7 @@ int pc_setpos(struct map_session_data* sd, unsigned short mapindex, int x, int y
sd->mapindex = mapindex;
sd->bl.x=x;
sd->bl.y=y;
- iPc->clean_skilltree(sd);
+ pc->clean_skilltree(sd);
chrif_save(sd,2);
chrif_changemapserver(sd, ip, (short)port);
@@ -4909,7 +4909,7 @@ int pc_setpos(struct map_session_data* sd, unsigned short mapindex, int x, int y
* Warp player sd to random location on current map.
* May fail if no walkable cell found (1000 attempts).
* Return:
- * 0 = fail or FIXME success (from iPc->setpos)
+ * 0 = fail or FIXME success (from pc->setpos)
* x(1|2) = fail
*------------------------------------------*/
int pc_randomwarp(struct map_session_data *sd, clr_type type)
@@ -4930,7 +4930,7 @@ int pc_randomwarp(struct map_session_data *sd, clr_type type)
}while(iMap->getcell(m,x,y,CELL_CHKNOPASS) && (i++)<1000 );
if (i < 1000)
- return iPc->setpos(sd,map[sd->bl.m].index,x,y,type);
+ return pc->setpos(sd,map[sd->bl.m].index,x,y,type);
return 0;
}
@@ -4956,7 +4956,7 @@ int pc_memo(struct map_session_data* sd, int pos)
return 0; // invalid input
// check required skill level
- skill = iPc->checkskill(sd, AL_WARP);
+ skill = pc->checkskill(sd, AL_WARP);
if( skill < 1 ) {
clif->skill_memomessage(sd,2); // "You haven't learned Warp."
return 0;
@@ -5616,7 +5616,7 @@ int pc_follow_timer(int tid, unsigned int tick, int id, intptr_t data)
if (tbl == NULL || pc_isdead(sd) || status_isdead(tbl))
{
- iPc->stop_following(sd);
+ pc->stop_following(sd);
return 0;
}
@@ -5629,7 +5629,7 @@ int pc_follow_timer(int tid, unsigned int tick, int id, intptr_t data)
if (!check_distance_bl(&sd->bl, tbl, 5))
unit_walktobl(&sd->bl, tbl, 5, 0);
} else
- iPc->setpos(sd, map_id2index(tbl->m), tbl->x, tbl->y, CLR_TELEPORT);
+ pc->setpos(sd, map_id2index(tbl->m), tbl->x, tbl->y, CLR_TELEPORT);
}
sd->followtimer = iTimer->add_timer(
tick + 1000, // increase time a bit to loosen up map's load
@@ -5659,7 +5659,7 @@ int pc_follow(struct map_session_data *sd,int target_id)
if (bl == NULL /*|| bl->type != BL_PC*/)
return 1;
if (sd->followtimer != INVALID_TIMER)
- iPc->stop_following(sd);
+ pc->stop_following(sd);
sd->followtarget = target_id;
pc_follow_timer(INVALID_TIMER, iTimer->gettick(), sd->bl.id, 0);
@@ -5668,7 +5668,7 @@ int pc_follow(struct map_session_data *sd,int target_id)
}
int pc_checkbaselevelup(struct map_session_data *sd) {
- unsigned int next = iPc->nextbaseexp(sd);
+ unsigned int next = pc->nextbaseexp(sd);
if (!next || sd->status.base_exp < next)
return 0;
@@ -5679,11 +5679,11 @@ int pc_checkbaselevelup(struct map_session_data *sd) {
if(!battle_config.multi_level_up && sd->status.base_exp > next-1)
sd->status.base_exp = next-1;
- next = iPc->gets_status_point(sd->status.base_level);
+ next = pc->gets_status_point(sd->status.base_level);
sd->status.base_level ++;
sd->status.status_point += next;
- } while ((next=iPc->nextbaseexp(sd)) > 0 && sd->status.base_exp >= next);
+ } while ((next=pc->nextbaseexp(sd)) > 0 && sd->status.base_exp >= next);
if (battle_config.pet_lv_rate && sd->pd) //<Skotlex> update pet's level
status_calc_pet(sd->pd,0);
@@ -5711,9 +5711,9 @@ int pc_checkbaselevelup(struct map_session_data *sd) {
npc_script_event(sd, NPCE_BASELVUP); //LORDALFA - LVLUPEVENT
if(sd->status.party_id)
- iParty->send_levelup(sd);
+ party->send_levelup(sd);
- iPc->baselevelchanged(sd);
+ pc->baselevelchanged(sd);
return 1;
}
@@ -5723,7 +5723,7 @@ void pc_baselevelchanged(struct map_session_data *sd) {
for( i = 0; i < EQI_MAX; i++ ) {
if( sd->equip_index[i] >= 0 ) {
if( sd->inventory_data[ sd->equip_index[i] ]->elvmax && sd->status.base_level > (unsigned int)sd->inventory_data[ sd->equip_index[i] ]->elvmax )
- iPc->unequipitem(sd, sd->equip_index[i], 3);
+ pc->unequipitem(sd, sd->equip_index[i], 3);
}
}
#endif
@@ -5731,7 +5731,7 @@ void pc_baselevelchanged(struct map_session_data *sd) {
}
int pc_checkjoblevelup(struct map_session_data *sd)
{
- unsigned int next = iPc->nextjobexp(sd);
+ unsigned int next = pc->nextjobexp(sd);
nullpo_ret(sd);
if(!next || sd->status.job_exp < next)
@@ -5746,7 +5746,7 @@ int pc_checkjoblevelup(struct map_session_data *sd)
sd->status.job_level ++;
sd->status.skill_point ++;
- } while ((next=iPc->nextjobexp(sd)) > 0 && sd->status.job_exp >= next);
+ } while ((next=pc->nextjobexp(sd)) > 0 && sd->status.job_exp >= next);
clif->updatestatus(sd,SP_JOBLEVEL);
clif->updatestatus(sd,SP_JOBEXP);
@@ -5754,7 +5754,7 @@ int pc_checkjoblevelup(struct map_session_data *sd)
clif->updatestatus(sd,SP_SKILLPOINT);
status_calc_pc(sd,0);
clif->misceffect(&sd->bl,1);
- if (iPc->checkskill(sd, SG_DEVIL) && !iPc->nextjobexp(sd))
+ if (pc->checkskill(sd, SG_DEVIL) && !pc->nextjobexp(sd))
clif->status_change(&sd->bl,SI_DEVIL, 1, 0, 0, 0, 1); //Permanent blind effect from SG_DEVIL.
npc_script_event(sd, NPCE_JOBLVUP);
@@ -5809,8 +5809,8 @@ int pc_gainexp(struct map_session_data *sd, struct block_list *src, unsigned int
if(src) pc_calcexp(sd, &base_exp, &job_exp, src);
- nextb = iPc->nextbaseexp(sd);
- nextj = iPc->nextjobexp(sd);
+ nextb = pc->nextbaseexp(sd);
+ nextj = pc->nextjobexp(sd);
if(sd->state.showexp || battle_config.max_exp_gain_rate){
if (nextb > 0)
@@ -5836,22 +5836,22 @@ int pc_gainexp(struct map_session_data *sd, struct block_list *src, unsigned int
//Cap exp to the level up requirement of the previous level when you are at max level, otherwise cap at UINT_MAX (this is required for some S. Novice bonuses). [Skotlex]
if (base_exp) {
- nextb = nextb?UINT_MAX:iPc->thisbaseexp(sd);
+ nextb = nextb?UINT_MAX:pc->thisbaseexp(sd);
if(sd->status.base_exp > nextb - base_exp)
sd->status.base_exp = nextb;
else
sd->status.base_exp += base_exp;
- iPc->checkbaselevelup(sd);
+ pc->checkbaselevelup(sd);
clif->updatestatus(sd,SP_BASEEXP);
}
if (job_exp) {
- nextj = nextj?UINT_MAX:iPc->thisjobexp(sd);
+ nextj = nextj?UINT_MAX:pc->thisjobexp(sd);
if(sd->status.job_exp > nextj - job_exp)
sd->status.job_exp = nextj;
else
sd->status.job_exp += job_exp;
- iPc->checkjoblevelup(sd);
+ pc->checkjoblevelup(sd);
clif->updatestatus(sd,SP_JOBEXP);
}
@@ -5874,12 +5874,12 @@ int pc_gainexp(struct map_session_data *sd, struct block_list *src, unsigned int
*------------------------------------------*/
unsigned int pc_maxbaselv(struct map_session_data *sd)
{
- return max_level[iPc->class2idx(sd->status.class_)][0];
+ return max_level[pc->class2idx(sd->status.class_)][0];
}
unsigned int pc_maxjoblv(struct map_session_data *sd)
{
- return max_level[iPc->class2idx(sd->status.class_)][1];
+ return max_level[pc->class2idx(sd->status.class_)][1];
}
/*==========================================
@@ -5891,19 +5891,19 @@ unsigned int pc_nextbaseexp(struct map_session_data *sd)
{
nullpo_ret(sd);
- if(sd->status.base_level>=iPc->maxbaselv(sd) || sd->status.base_level<=0)
+ if(sd->status.base_level>=pc->maxbaselv(sd) || sd->status.base_level<=0)
return 0;
- return exp_table[iPc->class2idx(sd->status.class_)][0][sd->status.base_level-1];
+ return exp_table[pc->class2idx(sd->status.class_)][0][sd->status.base_level-1];
}
//Base exp needed for this level.
unsigned int pc_thisbaseexp(struct map_session_data *sd)
{
- if(sd->status.base_level>iPc->maxbaselv(sd) || sd->status.base_level<=1)
+ if(sd->status.base_level>pc->maxbaselv(sd) || sd->status.base_level<=1)
return 0;
- return exp_table[iPc->class2idx(sd->status.class_)][0][sd->status.base_level-2];
+ return exp_table[pc->class2idx(sd->status.class_)][0][sd->status.base_level-2];
}
@@ -5919,17 +5919,17 @@ unsigned int pc_nextjobexp(struct map_session_data *sd)
{
nullpo_ret(sd);
- if(sd->status.job_level>=iPc->maxjoblv(sd) || sd->status.job_level<=0)
+ if(sd->status.job_level>=pc->maxjoblv(sd) || sd->status.job_level<=0)
return 0;
- return exp_table[iPc->class2idx(sd->status.class_)][1][sd->status.job_level-1];
+ return exp_table[pc->class2idx(sd->status.class_)][1][sd->status.job_level-1];
}
//Job exp needed for this level.
unsigned int pc_thisjobexp(struct map_session_data *sd)
{
- if(sd->status.job_level>iPc->maxjoblv(sd) || sd->status.job_level<=1)
+ if(sd->status.job_level>pc->maxjoblv(sd) || sd->status.job_level<=1)
return 0;
- return exp_table[iPc->class2idx(sd->status.class_)][1][sd->status.job_level-2];
+ return exp_table[pc->class2idx(sd->status.class_)][1][sd->status.job_level-2];
}
/// Returns the value of the specified stat.
@@ -6020,7 +6020,7 @@ int pc_statusup(struct map_session_data* sd, int type)
nullpo_ret(sd);
// check conditions
- need = iPc->need_status_point(sd,type,1);
+ need = pc->need_status_point(sd,type,1);
if( type < SP_STR || type > SP_LUK || need < 0 || need > sd->status.status_point )
{
clif->statusupack(sd,type,0,0);
@@ -6042,7 +6042,7 @@ int pc_statusup(struct map_session_data* sd, int type)
status_calc_pc(sd,0);
// update increase cost indicator
- if( need != iPc->need_status_point(sd,type,1) )
+ if( need != pc->need_status_point(sd,type,1) )
clif->updatestatus(sd, SP_USTR + type-SP_STR);
// update statpoint count
@@ -6073,7 +6073,7 @@ int pc_statusup2(struct map_session_data* sd, int type, int val)
return 1;
}
- need = iPc->need_status_point(sd,type,1);
+ need = pc->need_status_point(sd,type,1);
// set new value
max = pc_maxparameter(sd);
@@ -6082,7 +6082,7 @@ int pc_statusup2(struct map_session_data* sd, int type, int val)
status_calc_pc(sd,0);
// update increase cost indicator
- if( need != iPc->need_status_point(sd,type,1) )
+ if( need != pc->need_status_point(sd,type,1) )
clif->updatestatus(sd, SP_USTR + type-SP_STR);
// update stat value
@@ -6123,8 +6123,8 @@ int pc_skillup(struct map_session_data *sd,uint16 skill_id) {
sd->status.skill_point--;
if( !skill_db[index].inf )
status_calc_pc(sd,0); // Only recalculate for passive skills.
- else if( sd->status.skill_point == 0 && (sd->class_&MAPID_UPPERMASK) == MAPID_TAEKWON && sd->status.base_level >= 90 && iPc->famerank(sd->status.char_id, MAPID_TAEKWON) )
- iPc->calc_skilltree(sd); // Required to grant all TK Ranger skills.
+ else if( sd->status.skill_point == 0 && (sd->class_&MAPID_UPPERMASK) == MAPID_TAEKWON && sd->status.base_level >= 90 && pc->famerank(sd->status.char_id, MAPID_TAEKWON) )
+ pc->calc_skilltree(sd); // Required to grant all TK Ranger skills.
else
pc_check_skilltree(sd, skill_id); // Check if a new skill can Lvlup
@@ -6173,8 +6173,8 @@ int pc_allskillup(struct map_session_data *sd)
}
} else {
int inf2;
- for(i=0;i < MAX_SKILL_TREE && (id=skill_tree[iPc->class2idx(sd->status.class_)][i].id)>0;i++){
- int idx = skill_tree[iPc->class2idx(sd->status.class_)][i].idx;
+ for(i=0;i < MAX_SKILL_TREE && (id=skill_tree[pc->class2idx(sd->status.class_)][i].id)>0;i++){
+ int idx = skill_tree[pc->class2idx(sd->status.class_)][i].idx;
inf2 = skill_db[idx].inf2;
if (
(inf2&INF2_QUEST_SKILL && !battle_config.quest_skill_learn) ||
@@ -6204,7 +6204,7 @@ int pc_resetlvl(struct map_session_data* sd,int type)
nullpo_ret(sd);
if (type != 3) //Also reset skills
- iPc->resetskill(sd, 0);
+ pc->resetskill(sd, 0);
if(type == 1){
sd->status.skill_point=0;
@@ -6224,8 +6224,8 @@ int pc_resetlvl(struct map_session_data* sd,int type)
if(sd->status.class_ == JOB_NOVICE_HIGH) {
sd->status.status_point=100; // not 88 [celest]
// give platinum skills upon changing
- iPc->skill(sd,142,1,0);
- iPc->skill(sd,143,1,0);
+ pc->skill(sd,142,1,0);
+ pc->skill(sd,143,1,0);
}
}
@@ -6270,12 +6270,12 @@ int pc_resetlvl(struct map_session_data* sd,int type)
for(i=0;i<EQI_MAX;i++) { // unequip items that can't be equipped by base 1 [Valaris]
if(sd->equip_index[i] >= 0)
- if(!iPc->isequip(sd,sd->equip_index[i]))
- iPc->unequipitem(sd,sd->equip_index[i],2);
+ if(!pc->isequip(sd,sd->equip_index[i]))
+ pc->unequipitem(sd,sd->equip_index[i],2);
}
if ((type == 1 || type == 2 || type == 3) && sd->status.party_id)
- iParty->send_levelup(sd);
+ party->send_levelup(sd);
status_calc_pc(sd,0);
clif->skillinfoblock(sd);
@@ -6303,12 +6303,12 @@ int pc_resetstate(struct map_session_data* sd)
else
{
int add=0;
- add += iPc->need_status_point(sd, SP_STR, 1-pc_getstat(sd, SP_STR));
- add += iPc->need_status_point(sd, SP_AGI, 1-pc_getstat(sd, SP_AGI));
- add += iPc->need_status_point(sd, SP_VIT, 1-pc_getstat(sd, SP_VIT));
- add += iPc->need_status_point(sd, SP_INT, 1-pc_getstat(sd, SP_INT));
- add += iPc->need_status_point(sd, SP_DEX, 1-pc_getstat(sd, SP_DEX));
- add += iPc->need_status_point(sd, SP_LUK, 1-pc_getstat(sd, SP_LUK));
+ add += pc->need_status_point(sd, SP_STR, 1-pc_getstat(sd, SP_STR));
+ add += pc->need_status_point(sd, SP_AGI, 1-pc_getstat(sd, SP_AGI));
+ add += pc->need_status_point(sd, SP_VIT, 1-pc_getstat(sd, SP_VIT));
+ add += pc->need_status_point(sd, SP_INT, 1-pc_getstat(sd, SP_INT));
+ add += pc->need_status_point(sd, SP_DEX, 1-pc_getstat(sd, SP_DEX));
+ add += pc->need_status_point(sd, SP_LUK, 1-pc_getstat(sd, SP_LUK));
sd->status.status_point+=add;
}
@@ -6366,35 +6366,35 @@ int pc_resetskill(struct map_session_data* sd, int flag)
/**
* It has been confirmed on official server that when you reset skills with a ranked tweakwon your skills are not reset (because you have all of them anyway)
**/
- if( (sd->class_&MAPID_UPPERMASK) == MAPID_TAEKWON && sd->status.base_level >= 90 && iPc->famerank(sd->status.char_id, MAPID_TAEKWON) )
+ if( (sd->class_&MAPID_UPPERMASK) == MAPID_TAEKWON && sd->status.base_level >= 90 && pc->famerank(sd->status.char_id, MAPID_TAEKWON) )
return 0;
- if( iPc->checkskill(sd, SG_DEVIL) && !iPc->nextjobexp(sd) ) //Remove perma blindness due to skill-reset. [Skotlex]
+ if( pc->checkskill(sd, SG_DEVIL) && !pc->nextjobexp(sd) ) //Remove perma blindness due to skill-reset. [Skotlex]
clif->sc_end(&sd->bl, sd->bl.id, SELF, SI_DEVIL);
i = sd->sc.option;
- if( i&OPTION_RIDING && (!iPc->checkskill(sd, KN_RIDING) || (sd->class_&MAPID_THIRDMASK) == MAPID_RUNE_KNIGHT) )
+ if( i&OPTION_RIDING && (!pc->checkskill(sd, KN_RIDING) || (sd->class_&MAPID_THIRDMASK) == MAPID_RUNE_KNIGHT) )
i &= ~OPTION_RIDING;
- if( i&OPTION_FALCON && iPc->checkskill(sd, HT_FALCON) )
+ if( i&OPTION_FALCON && pc->checkskill(sd, HT_FALCON) )
i &= ~OPTION_FALCON;
- if( i&OPTION_DRAGON && iPc->checkskill(sd, RK_DRAGONTRAINING) )
+ if( i&OPTION_DRAGON && pc->checkskill(sd, RK_DRAGONTRAINING) )
i &= ~OPTION_DRAGON;
- if( i&OPTION_WUG && iPc->checkskill(sd, RA_WUGMASTERY) )
+ if( i&OPTION_WUG && pc->checkskill(sd, RA_WUGMASTERY) )
i &= ~OPTION_WUG;
- if( i&OPTION_WUGRIDER && iPc->checkskill(sd, RA_WUGRIDER) )
+ if( i&OPTION_WUGRIDER && pc->checkskill(sd, RA_WUGRIDER) )
i &= ~OPTION_WUGRIDER;
if( i&OPTION_MADOGEAR && ( sd->class_&MAPID_THIRDMASK ) == MAPID_MECHANIC )
i &= ~OPTION_MADOGEAR;
#ifndef NEW_CARTS
- if( i&OPTION_CART && iPc->checkskill(sd, MC_PUSHCART) )
+ if( i&OPTION_CART && pc->checkskill(sd, MC_PUSHCART) )
i &= ~OPTION_CART;
#else
if( sd->sc.data[SC_PUSH_CART] )
- iPc->setcart(sd, 0);
+ pc->setcart(sd, 0);
#endif
if( i != sd->sc.option )
- iPc->setoption(sd, i);
+ pc->setoption(sd, i);
- if( homun_alive(sd->hd) && iPc->checkskill(sd, AM_CALLHOMUN) )
+ if( homun_alive(sd->hd) && pc->checkskill(sd, AM_CALLHOMUN) )
homun->vaporize(sd, 0);
}
@@ -6544,9 +6544,9 @@ void pc_respawn(struct map_session_data* sd, clr_type clrtype)
if( sd->bg_id && bg_member_respawn(sd) )
return; // member revived by battleground
- iPc->setstand(sd);
- iPc->setrestartvalue(sd,3);
- if( iPc->setpos(sd, sd->status.save_point.map, sd->status.save_point.x, sd->status.save_point.y, clrtype) )
+ pc->setstand(sd);
+ pc->setrestartvalue(sd,3);
+ if( pc->setpos(sd, sd->status.save_point.map, sd->status.save_point.x, sd->status.save_point.y, clrtype) )
clif->resurrection(&sd->bl, 1); //If warping fails, send a normal stand up packet.
}
@@ -6556,7 +6556,7 @@ static int pc_respawn_timer(int tid, unsigned int tick, int id, intptr_t data)
if( sd != NULL )
{
sd->pvp_point=0;
- iPc->respawn(sd,CLR_OUTSIGHT);
+ pc->respawn(sd,CLR_OUTSIGHT);
}
return 0;
@@ -6575,7 +6575,7 @@ void pc_damage(struct map_session_data *sd,struct block_list *src,unsigned int h
return;
if( pc_issit(sd) ) {
- iPc->setstand(sd);
+ pc->setstand(sd);
skill->sit(sd,0);
}
@@ -6641,7 +6641,7 @@ int pc_dead(struct map_session_data *sd,struct block_list *src) {
npc_event_dequeue(sd);
pc_setglobalreg(sd,"PC_DIE_COUNTER",sd->die_counter+1);
- iPc->setparam(sd, SP_KILLERRID, src?src->id:0);
+ pc->setparam(sd, SP_KILLERRID, src?src->id:0);
if( sd->bg_id ) {/* TODO: purge when bgqueue is deemed ok */
struct battleground_data *bg;
@@ -6673,7 +6673,7 @@ int pc_dead(struct map_session_data *sd,struct block_list *src) {
sd->st->state = END;
}
- /* e.g. not killed thru iPc->damage */
+ /* e.g. not killed thru pc->damage */
if( pc_issit(sd) ) {
clif->sc_end(&sd->bl,sd->bl.id,SELF,SI_SIT);
}
@@ -6688,10 +6688,10 @@ int pc_dead(struct map_session_data *sd,struct block_list *src) {
sd->hp_loss.tick = sd->sp_loss.tick = sd->hp_regen.tick = sd->sp_regen.tick = 0;
if ( sd && sd->spiritball )
- iPc->delspiritball(sd,sd->spiritball,0);
+ pc->delspiritball(sd,sd->spiritball,0);
for(i = 1; i < 5; i++)
- iPc->del_talisman(sd, sd->talisman[i], i);
+ pc->del_talisman(sd, sd->talisman[i], i);
if (src) {
switch (src->type) {
@@ -6701,7 +6701,7 @@ int pc_dead(struct map_session_data *sd,struct block_list *src) {
if(md->target_id==sd->bl.id)
mob_unlocktarget(md,tick);
if(battle_config.mobs_level_up && md->status.hp &&
- (unsigned int)md->level < iPc->maxbaselv(sd) &&
+ (unsigned int)md->level < pc->maxbaselv(sd) &&
!md->guardian_data && !md->special_state.ai// Guardians/summons should not level. [Skotlex]
) { // monster level up [Valaris]
clif->misceffect(&md->bl,0);
@@ -6731,7 +6731,7 @@ int pc_dead(struct map_session_data *sd,struct block_list *src) {
if (src && src->type == BL_PC) {
struct map_session_data *ssd = (struct map_session_data *)src;
- iPc->setparam(ssd, SP_KILLEDRID, sd->bl.id);
+ pc->setparam(ssd, SP_KILLEDRID, sd->bl.id);
npc_script_event(ssd, NPCE_KILLPC);
if (battle_config.pk_mode&2) {
@@ -6781,15 +6781,15 @@ int pc_dead(struct map_session_data *sd,struct block_list *src) {
// activate Steel body if a super novice dies at 99+% exp [celest]
if ((sd->class_&MAPID_UPPERMASK) == MAPID_SUPER_NOVICE && !sd->state.snovice_dead_flag)
{
- unsigned int next = iPc->nextbaseexp(sd);
- if( next == 0 ) next = iPc->thisbaseexp(sd);
+ unsigned int next = pc->nextbaseexp(sd);
+ if( next == 0 ) next = pc->thisbaseexp(sd);
if( get_percentage(sd->status.base_exp,next) >= 99 ) {
sd->state.snovice_dead_flag = 1;
- iPc->setstand(sd);
+ pc->setstand(sd);
status_percent_heal(&sd->bl, 100, 100);
clif->resurrection(&sd->bl, 1);
if(battle_config.pc_invincible_time)
- iPc->setinvincibletimer(sd, battle_config.pc_invincible_time);
+ pc->setinvincibletimer(sd, battle_config.pc_invincible_time);
sc_start(&sd->bl,status_skill2sc(MO_STEELBODY),100,1,skill->get_time(MO_STEELBODY,1));
if(map_flag_gvg(sd->bl.m))
pc_respawn_timer(INVALID_TIMER, iTimer->gettick(), sd->bl.id, 0);
@@ -6807,7 +6807,7 @@ int pc_dead(struct map_session_data *sd,struct block_list *src) {
if (battle_config.death_penalty_base > 0) {
switch (battle_config.death_penalty_type) {
case 1:
- base_penalty = (unsigned int) ((double)iPc->nextbaseexp(sd) * (double)battle_config.death_penalty_base/10000);
+ base_penalty = (unsigned int) ((double)pc->nextbaseexp(sd) * (double)battle_config.death_penalty_base/10000);
break;
case 2:
base_penalty = (unsigned int) ((double)sd->status.base_exp * (double)battle_config.death_penalty_base/10000);
@@ -6825,7 +6825,7 @@ int pc_dead(struct map_session_data *sd,struct block_list *src) {
base_penalty = 0;
switch (battle_config.death_penalty_type) {
case 1:
- base_penalty = (unsigned int) ((double)iPc->nextjobexp(sd) * (double)battle_config.death_penalty_job/10000);
+ base_penalty = (unsigned int) ((double)pc->nextjobexp(sd) * (double)battle_config.death_penalty_job/10000);
break;
case 2:
base_penalty = (unsigned int) ((double)sd->status.job_exp * (double)battle_config.death_penalty_job/10000);
@@ -6842,7 +6842,7 @@ int pc_dead(struct map_session_data *sd,struct block_list *src) {
{
base_penalty = (unsigned int)((double)sd->status.zeny * (double)battle_config.zeny_penalty / 10000.);
if(base_penalty)
- iPc->payzeny(sd, base_penalty, LOG_TYPE_PICKDROP_PLAYER, NULL);
+ pc->payzeny(sd, base_penalty, LOG_TYPE_PICKDROP_PLAYER, NULL);
}
}
@@ -6874,8 +6874,8 @@ int pc_dead(struct map_session_data *sd,struct block_list *src) {
int n = eq_n[rnd()%eq_num];
if(rnd()%10000 < per){
if(sd->status.inventory[n].equip)
- iPc->unequipitem(sd,n,3);
- iPc->dropitem(sd,n,1);
+ pc->unequipitem(sd,n,3);
+ pc->dropitem(sd,n,1);
}
}
}
@@ -6887,8 +6887,8 @@ int pc_dead(struct map_session_data *sd,struct block_list *src) {
|| (type == 2 && sd->status.inventory[i].equip)
|| type == 3) ){
if(sd->status.inventory[i].equip)
- iPc->unequipitem(sd,i,3);
- iPc->dropitem(sd,i,1);
+ pc->unequipitem(sd,i,3);
+ pc->dropitem(sd,i,1);
break;
}
}
@@ -6940,9 +6940,9 @@ void pc_revive(struct map_session_data *sd,unsigned int hp, unsigned int sp) {
if(hp) clif->updatestatus(sd,SP_HP);
if(sp) clif->updatestatus(sd,SP_SP);
- iPc->setstand(sd);
+ pc->setstand(sd);
if(battle_config.pc_invincible_time > 0)
- iPc->setinvincibletimer(sd, battle_config.pc_invincible_time);
+ pc->setinvincibletimer(sd, battle_config.pc_invincible_time);
if( sd->state.gmaster_flag ) {
guild->aura_refresh(sd,GD_LEADERSHIP,guild->checkskill(sd->state.gmaster_flag,GD_LEADERSHIP));
@@ -6969,16 +6969,16 @@ int pc_readparam(struct map_session_data* sd,int type)
case SP_BASELEVEL: val = sd->status.base_level; break;
case SP_JOBLEVEL: val = sd->status.job_level; break;
case SP_CLASS: val = sd->status.class_; break;
- case SP_BASEJOB: val = iPc->mapid2jobid(sd->class_&MAPID_UPPERMASK, sd->status.sex); break; //Base job, extracting upper type.
+ case SP_BASEJOB: val = pc->mapid2jobid(sd->class_&MAPID_UPPERMASK, sd->status.sex); break; //Base job, extracting upper type.
case SP_UPPER: val = sd->class_&JOBL_UPPER?1:(sd->class_&JOBL_BABY?2:0); break;
- case SP_BASECLASS: val = iPc->mapid2jobid(sd->class_&MAPID_BASEMASK, sd->status.sex); break; //Extract base class tree. [Skotlex]
+ case SP_BASECLASS: val = pc->mapid2jobid(sd->class_&MAPID_BASEMASK, sd->status.sex); break; //Extract base class tree. [Skotlex]
case SP_SEX: val = sd->status.sex; break;
case SP_WEIGHT: val = sd->weight; break;
case SP_MAXWEIGHT: val = sd->max_weight; break;
case SP_BASEEXP: val = sd->status.base_exp; break;
case SP_JOBEXP: val = sd->status.job_exp; break;
- case SP_NEXTBASEEXP: val = iPc->nextbaseexp(sd); break;
- case SP_NEXTJOBEXP: val = iPc->nextjobexp(sd); break;
+ case SP_NEXTBASEEXP: val = pc->nextbaseexp(sd); break;
+ case SP_NEXTJOBEXP: val = pc->nextjobexp(sd); break;
case SP_HP: val = sd->battle_status.hp; break;
case SP_MAXHP: val = sd->battle_status.max_hp; break;
case SP_SP: val = sd->battle_status.sp; break;
@@ -7114,12 +7114,12 @@ int pc_setparam(struct map_session_data *sd,int type,int val)
switch(type){
case SP_BASELEVEL:
- if ((unsigned int)val > iPc->maxbaselv(sd)) //Capping to max
- val = iPc->maxbaselv(sd);
+ if ((unsigned int)val > pc->maxbaselv(sd)) //Capping to max
+ val = pc->maxbaselv(sd);
if ((unsigned int)val > sd->status.base_level) {
int stat=0;
for (i = 0; i < (int)((unsigned int)val - sd->status.base_level); i++)
- stat += iPc->gets_status_point(sd->status.base_level + i);
+ stat += pc->gets_status_point(sd->status.base_level + i);
sd->status.status_point += stat;
}
sd->status.base_level = (unsigned int)val;
@@ -7131,12 +7131,12 @@ int pc_setparam(struct map_session_data *sd,int type,int val)
status_calc_pc(sd, 0);
if(sd->status.party_id)
{
- iParty->send_levelup(sd);
+ party->send_levelup(sd);
}
break;
case SP_JOBLEVEL:
if ((unsigned int)val >= sd->status.job_level) {
- if ((unsigned int)val > iPc->maxjoblv(sd)) val = iPc->maxjoblv(sd);
+ if ((unsigned int)val > pc->maxjoblv(sd)) val = pc->maxjoblv(sd);
sd->status.skill_point += val - sd->status.job_level;
clif->updatestatus(sd, SP_SKILLPOINT);
}
@@ -7160,15 +7160,15 @@ int pc_setparam(struct map_session_data *sd,int type,int val)
sd->status.zeny = cap_value(val, 0, MAX_ZENY);
break;
case SP_BASEEXP:
- if(iPc->nextbaseexp(sd) > 0) {
+ if(pc->nextbaseexp(sd) > 0) {
sd->status.base_exp = val;
- iPc->checkbaselevelup(sd);
+ pc->checkbaselevelup(sd);
}
break;
case SP_JOBEXP:
- if(iPc->nextjobexp(sd) > 0) {
+ if(pc->nextjobexp(sd) > 0) {
sd->status.job_exp = val;
- iPc->checkjoblevelup(sd);
+ pc->checkjoblevelup(sd);
}
break;
case SP_SEX:
@@ -7283,8 +7283,8 @@ int pc_itemheal(struct map_session_data *sd,int itemid, int hp,int sp)
if(hp) {
int i;
bonus = 100 + (sd->battle_status.vit<<1)
- + iPc->checkskill(sd,SM_RECOVERY)*10
- + iPc->checkskill(sd,AM_LEARNINGPOTION)*5;
+ + pc->checkskill(sd,SM_RECOVERY)*10
+ + pc->checkskill(sd,AM_LEARNINGPOTION)*5;
// A potion produced by an Alchemist in the Fame Top 10 gets +50% effect [DracoRPG]
if (potion_flag > 1)
bonus += bonus*(potion_flag-1)*50/100;
@@ -7309,8 +7309,8 @@ int pc_itemheal(struct map_session_data *sd,int itemid, int hp,int sp)
}
if(sp) {
bonus = 100 + (sd->battle_status.int_<<1)
- + iPc->checkskill(sd,MG_SRECOVERY)*10
- + iPc->checkskill(sd,AM_LEARNINGPOTION)*5;
+ + pc->checkskill(sd,MG_SRECOVERY)*10
+ + pc->checkskill(sd,AM_LEARNINGPOTION)*5;
if (potion_flag > 1)
bonus += bonus*(potion_flag-1)*50/100;
if(bonus != 100)
@@ -7407,7 +7407,7 @@ int pc_jobchange(struct map_session_data *sd,int job, int upper)
return 1;
//Normalize job.
- b_class = iPc->jobid2mapid(job);
+ b_class = pc->jobid2mapid(job);
if (b_class == -1)
return 1;
switch (upper) {
@@ -7420,7 +7420,7 @@ int pc_jobchange(struct map_session_data *sd,int job, int upper)
}
//This will automatically adjust bard/dancer classes to the correct gender
//That is, if you try to jobchange into dancer, it will turn you to bard.
- job = iPc->mapid2jobid(b_class, sd->status.sex);
+ job = pc->mapid2jobid(b_class, sd->status.sex);
if (job == -1)
return 1;
@@ -7465,7 +7465,7 @@ int pc_jobchange(struct map_session_data *sd,int job, int upper)
}
if ( (b_class&MAPID_UPPERMASK) != (sd->class_&MAPID_UPPERMASK) ) { //Things to remove when changing class tree.
- const int class_ = iPc->class2idx(sd->status.class_);
+ const int class_ = pc->class2idx(sd->status.class_);
short id;
for(i = 0; i < MAX_SKILL_TREE && (id = skill_tree[class_][i].id) > 0; i++) {
//Remove status specific to your current tree skills.
@@ -7477,19 +7477,19 @@ int pc_jobchange(struct map_session_data *sd,int job, int upper)
if( (sd->class_&MAPID_UPPERMASK) == MAPID_STAR_GLADIATOR && (b_class&MAPID_UPPERMASK) != MAPID_STAR_GLADIATOR) {
/* going off star glad lineage, reset feel to not store no-longer-used vars in the database */
- iPc->resetfeel(sd);
+ pc->resetfeel(sd);
}
sd->status.class_ = job;
- fame_flag = iPc->famerank(sd->status.char_id,sd->class_&MAPID_UPPERMASK);
+ fame_flag = pc->famerank(sd->status.char_id,sd->class_&MAPID_UPPERMASK);
sd->class_ = (unsigned short)b_class;
sd->status.job_level=1;
sd->status.job_exp=0;
- if (sd->status.base_level > iPc->maxbaselv(sd)) {
- sd->status.base_level = iPc->maxbaselv(sd);
+ if (sd->status.base_level > pc->maxbaselv(sd)) {
+ sd->status.base_level = pc->maxbaselv(sd);
sd->status.base_exp=0;
- iPc->resetstate(sd);
+ pc->resetstate(sd);
clif->updatestatus(sd,SP_STATUSPOINT);
clif->updatestatus(sd,SP_BASELEVEL);
clif->updatestatus(sd,SP_BASEEXP);
@@ -7502,14 +7502,14 @@ int pc_jobchange(struct map_session_data *sd,int job, int upper)
for(i=0;i<EQI_MAX;i++) {
if(sd->equip_index[i] >= 0)
- if(!iPc->isequip(sd,sd->equip_index[i]))
- iPc->unequipitem(sd,sd->equip_index[i],2); // unequip invalid item for class
+ if(!pc->isequip(sd,sd->equip_index[i]))
+ pc->unequipitem(sd,sd->equip_index[i],2); // unequip invalid item for class
}
//Change look, if disguised, you need to undisguise
//to correctly calculate new job sprite without
if (sd->disguise != -1)
- iPc->disguise(sd, -1);
+ pc->disguise(sd, -1);
status_set_viewdata(&sd->bl, job);
clif->changelook(&sd->bl,LOOK_BASE,sd->vd.class_); // move sprite update to prevent client crashes with incompatible equipment [Valaris]
@@ -7517,7 +7517,7 @@ int pc_jobchange(struct map_session_data *sd,int job, int upper)
clif->changelook(&sd->bl,LOOK_CLOTHES_COLOR,sd->vd.cloth_color);
//Update skill tree.
- iPc->calc_skilltree(sd);
+ pc->calc_skilltree(sd);
clif->skillinfoblock(sd);
if (sd->ed)
@@ -7529,37 +7529,37 @@ int pc_jobchange(struct map_session_data *sd,int job, int upper)
//Remove peco/cart/falcon
i = sd->sc.option;
- if( i&OPTION_RIDING && !iPc->checkskill(sd, KN_RIDING) )
+ if( i&OPTION_RIDING && !pc->checkskill(sd, KN_RIDING) )
i&=~OPTION_RIDING;
- if( i&OPTION_FALCON && !iPc->checkskill(sd, HT_FALCON) )
+ if( i&OPTION_FALCON && !pc->checkskill(sd, HT_FALCON) )
i&=~OPTION_FALCON;
- if( i&OPTION_DRAGON && !iPc->checkskill(sd,RK_DRAGONTRAINING) )
+ if( i&OPTION_DRAGON && !pc->checkskill(sd,RK_DRAGONTRAINING) )
i&=~OPTION_DRAGON;
- if( i&OPTION_WUGRIDER && !iPc->checkskill(sd,RA_WUGMASTERY) )
+ if( i&OPTION_WUGRIDER && !pc->checkskill(sd,RA_WUGMASTERY) )
i&=~OPTION_WUGRIDER;
- if( i&OPTION_WUG && !iPc->checkskill(sd,RA_WUGMASTERY) )
+ if( i&OPTION_WUG && !pc->checkskill(sd,RA_WUGMASTERY) )
i&=~OPTION_WUG;
if( i&OPTION_MADOGEAR ) //You do not need a skill for this.
i&=~OPTION_MADOGEAR;
#ifndef NEW_CARTS
- if( i&OPTION_CART && !iPc->checkskill(sd, MC_PUSHCART) )
+ if( i&OPTION_CART && !pc->checkskill(sd, MC_PUSHCART) )
i&=~OPTION_CART;
#else
- if( sd->sc.data[SC_PUSH_CART] && !iPc->checkskill(sd, MC_PUSHCART) )
- iPc->setcart(sd, 0);
+ if( sd->sc.data[SC_PUSH_CART] && !pc->checkskill(sd, MC_PUSHCART) )
+ pc->setcart(sd, 0);
#endif
if(i != sd->sc.option)
- iPc->setoption(sd, i);
+ pc->setoption(sd, i);
- if(homun_alive(sd->hd) && !iPc->checkskill(sd, AM_CALLHOMUN))
+ if(homun_alive(sd->hd) && !pc->checkskill(sd, AM_CALLHOMUN))
homun->vaporize(sd, 0);
if(sd->status.manner < 0)
clif->changestatus(sd,SP_MANNER,sd->status.manner);
status_calc_pc(sd,0);
- iPc->checkallowskill(sd);
- iPc->equiplookall(sd);
+ pc->checkallowskill(sd);
+ pc->equiplookall(sd);
//if you were previously famous, not anymore.
if (fame_flag) {
@@ -7677,7 +7677,7 @@ int pc_setoption(struct map_session_data *sd,int type)
sd->sc.option=type;
clif->changeoption(&sd->bl);
- if( (type&OPTION_RIDING && !(p_type&OPTION_RIDING)) || (type&OPTION_DRAGON && !(p_type&OPTION_DRAGON) && iPc->checkskill(sd,RK_DRAGONTRAINING) > 0) ) {
+ if( (type&OPTION_RIDING && !(p_type&OPTION_RIDING)) || (type&OPTION_DRAGON && !(p_type&OPTION_DRAGON) && pc->checkskill(sd,RK_DRAGONTRAINING) > 0) ) {
// Mounting
clif->sc_load(&sd->bl,sd->bl.id,AREA,SI_RIDING, 0, 0, 0);
status_calc_pc(sd,0);
@@ -7691,11 +7691,11 @@ int pc_setoption(struct map_session_data *sd,int type)
if( type&OPTION_CART && !( p_type&OPTION_CART ) ) { //Cart On
clif->cartlist(sd);
clif->updatestatus(sd, SP_CARTINFO);
- if(iPc->checkskill(sd, MC_PUSHCART) < 10)
+ if(pc->checkskill(sd, MC_PUSHCART) < 10)
status_calc_pc(sd,0); //Apply speed penalty.
} else if( !( type&OPTION_CART ) && p_type&OPTION_CART ){ //Cart Off
clif->clearcart(sd->fd);
- if(iPc->checkskill(sd, MC_PUSHCART) < 10)
+ if(pc->checkskill(sd, MC_PUSHCART) < 10)
status_calc_pc(sd,0); //Remove speed penalty.
}
#endif
@@ -7769,7 +7769,7 @@ int pc_setcart(struct map_session_data *sd,int type) {
if( type < 0 || type > MAX_CARTS )
return 1;// Never trust the values sent by the client! [Skotlex]
- if( iPc->checkskill(sd,MC_PUSHCART) <= 0 && type != 0 )
+ if( pc->checkskill(sd,MC_PUSHCART) <= 0 && type != 0 )
return 1;// Push cart is required
if( type == 0 && pc_iscarton(sd) )
@@ -7796,14 +7796,14 @@ int pc_setcart(struct map_session_data *sd,int type) {
break;
}
- if(iPc->checkskill(sd, MC_PUSHCART) < 10)
+ if(pc->checkskill(sd, MC_PUSHCART) < 10)
status_calc_pc(sd,0); //Recalc speed penalty.
#else
// Update option
option = sd->sc.option;
option &= ~OPTION_CART;// clear cart bits
option |= cart[type]; // set cart
- iPc->setoption(sd, option);
+ pc->setoption(sd, option);
#endif
return 0;
@@ -7815,10 +7815,10 @@ int pc_setcart(struct map_session_data *sd,int type) {
int pc_setfalcon(TBL_PC* sd, int flag)
{
if( flag ){
- if( iPc->checkskill(sd,HT_FALCON)>0 ) // add falcon if he have the skill
- iPc->setoption(sd,sd->sc.option|OPTION_FALCON);
+ if( pc->checkskill(sd,HT_FALCON)>0 ) // add falcon if he have the skill
+ pc->setoption(sd,sd->sc.option|OPTION_FALCON);
} else if( pc_isfalcon(sd) ){
- iPc->setoption(sd,sd->sc.option&~OPTION_FALCON); // remove falcon
+ pc->setoption(sd,sd->sc.option&~OPTION_FALCON); // remove falcon
}
return 0;
@@ -7830,10 +7830,10 @@ int pc_setfalcon(TBL_PC* sd, int flag)
int pc_setriding(TBL_PC* sd, int flag)
{
if( flag ){
- if( iPc->checkskill(sd,KN_RIDING) > 0 ) // add peco
- iPc->setoption(sd, sd->sc.option|OPTION_RIDING);
+ if( pc->checkskill(sd,KN_RIDING) > 0 ) // add peco
+ pc->setoption(sd, sd->sc.option|OPTION_RIDING);
} else if( pc_isriding(sd) ){
- iPc->setoption(sd, sd->sc.option&~OPTION_RIDING);
+ pc->setoption(sd, sd->sc.option&~OPTION_RIDING);
}
return 0;
@@ -7845,10 +7845,10 @@ int pc_setriding(TBL_PC* sd, int flag)
int pc_setmadogear(TBL_PC* sd, int flag)
{
if( flag ){
- if( iPc->checkskill(sd,NC_MADOLICENCE) > 0 )
- iPc->setoption(sd, sd->sc.option|OPTION_MADOGEAR);
+ if( pc->checkskill(sd,NC_MADOLICENCE) > 0 )
+ pc->setoption(sd, sd->sc.option|OPTION_MADOGEAR);
} else if( pc_ismadogear(sd) ){
- iPc->setoption(sd, sd->sc.option&~OPTION_MADOGEAR);
+ pc->setoption(sd, sd->sc.option&~OPTION_MADOGEAR);
}
return 0;
@@ -7861,9 +7861,9 @@ int pc_candrop(struct map_session_data *sd, struct item *item)
{
if( item && item->expire_time )
return 0;
- if( !iPc->can_give_items(sd) ) //check if this GM level can drop items
+ if( !pc->can_give_items(sd) ) //check if this GM level can drop items
return 0;
- return (itemdb_isdropable(item, iPc->get_group_level(sd)));
+ return (itemdb_isdropable(item, pc->get_group_level(sd)));
}
/*==========================================
@@ -8493,12 +8493,12 @@ int pc_equipitem(struct map_session_data *sd,int n,int req_pos)
}
id = sd->inventory_data[n];
- pos = iPc->equippoint(sd,n); //With a few exceptions, item should go in all specified slots.
+ pos = pc->equippoint(sd,n); //With a few exceptions, item should go in all specified slots.
if(battle_config.battle_log)
ShowInfo("equip %d(%d) %x:%x\n",sd->status.inventory[n].nameid,n,id?id->equip:0,req_pos);
- if(!iPc->isequip(sd,n) || !(pos&req_pos) || sd->status.inventory[n].equip != 0 || sd->status.inventory[n].attribute==1 ) { // [Valaris]
- // FIXME: iPc->isequip: equip level failure uses 2 instead of 0
+ if(!pc->isequip(sd,n) || !(pos&req_pos) || sd->status.inventory[n].equip != 0 || sd->status.inventory[n].attribute==1 ) { // [Valaris]
+ // FIXME: pc->isequip: equip level failure uses 2 instead of 0
clif->equipitemack(sd,n,0,0); // fail
return 0;
}
@@ -8534,7 +8534,7 @@ int pc_equipitem(struct map_session_data *sd,int n,int req_pos)
for(i=0;i<EQI_MAX;i++) {
if(pos & equip_pos[i]) {
if(sd->equip_index[i] >= 0) //Slot taken, remove item from there.
- iPc->unequipitem(sd,sd->equip_index[i],2);
+ pc->unequipitem(sd,sd->equip_index[i],2);
sd->equip_index[i] = n;
}
@@ -8576,21 +8576,21 @@ int pc_equipitem(struct map_session_data *sd,int n,int req_pos)
}
//Added check to prevent sending the same look on multiple slots ->
//causes client to redraw item on top of itself. (suggested by Lupus)
- if(pos & EQP_HEAD_LOW && iPc->checkequip(sd,EQP_COSTUME_HEAD_LOW) == -1) {
+ if(pos & EQP_HEAD_LOW && pc->checkequip(sd,EQP_COSTUME_HEAD_LOW) == -1) {
if(id && !(pos&(EQP_HEAD_TOP|EQP_HEAD_MID)))
sd->status.head_bottom = id->look;
else
sd->status.head_bottom = 0;
clif->changelook(&sd->bl,LOOK_HEAD_BOTTOM,sd->status.head_bottom);
}
- if(pos & EQP_HEAD_TOP && iPc->checkequip(sd,EQP_COSTUME_HEAD_TOP) == -1) {
+ if(pos & EQP_HEAD_TOP && pc->checkequip(sd,EQP_COSTUME_HEAD_TOP) == -1) {
if(id)
sd->status.head_top = id->look;
else
sd->status.head_top = 0;
clif->changelook(&sd->bl,LOOK_HEAD_TOP,sd->status.head_top);
}
- if(pos & EQP_HEAD_MID && iPc->checkequip(sd,EQP_COSTUME_HEAD_MID) == -1) {
+ if(pos & EQP_HEAD_MID && pc->checkequip(sd,EQP_COSTUME_HEAD_MID) == -1) {
if(id && !(pos&EQP_HEAD_TOP))
sd->status.head_mid = id->look;
else
@@ -8621,7 +8621,7 @@ int pc_equipitem(struct map_session_data *sd,int n,int req_pos)
if(pos & EQP_SHOES)
clif->changelook(&sd->bl,LOOK_SHOES,0);
- if( pos&EQP_GARMENT && iPc->checkequip(sd,EQP_COSTUME_GARMENT) == -1 ) {
+ if( pos&EQP_GARMENT && pc->checkequip(sd,EQP_COSTUME_GARMENT) == -1 ) {
sd->status.robe = id ? id->look : 0;
clif->changelook(&sd->bl, LOOK_ROBE, sd->status.robe);
}
@@ -8632,7 +8632,7 @@ int pc_equipitem(struct map_session_data *sd,int n,int req_pos)
}
- iPc->checkallowskill(sd); //Check if status changes should be halted.
+ pc->checkallowskill(sd); //Check if status changes should be halted.
iflag = sd->npc_item_flag;
/* check for combos (MUST be before status_calc_pc) */
@@ -8712,7 +8712,7 @@ int pc_unequipitem(struct map_session_data *sd,int n,int flag) {
}
if(battle_config.battle_log)
- ShowInfo("unequip %d %x:%x\n",n,iPc->equippoint(sd,n),sd->status.inventory[n].equip);
+ ShowInfo("unequip %d %x:%x\n",n,pc->equippoint(sd,n),sd->status.inventory[n].equip);
if(!sd->status.inventory[n].equip){ //Nothing to unequip
clif->unequipitemack(sd,n,0,0);
@@ -8736,44 +8736,44 @@ int pc_unequipitem(struct map_session_data *sd,int n,int flag) {
pc_calcweapontype(sd);
clif->changelook(&sd->bl,LOOK_SHIELD,sd->status.shield);
}
- if(sd->status.inventory[n].equip & EQP_HEAD_LOW && iPc->checkequip(sd,EQP_COSTUME_HEAD_LOW) == -1 ) {
+ if(sd->status.inventory[n].equip & EQP_HEAD_LOW && pc->checkequip(sd,EQP_COSTUME_HEAD_LOW) == -1 ) {
sd->status.head_bottom = 0;
clif->changelook(&sd->bl,LOOK_HEAD_BOTTOM,sd->status.head_bottom);
}
- if(sd->status.inventory[n].equip & EQP_HEAD_TOP && iPc->checkequip(sd,EQP_COSTUME_HEAD_TOP) == -1 ) {
+ if(sd->status.inventory[n].equip & EQP_HEAD_TOP && pc->checkequip(sd,EQP_COSTUME_HEAD_TOP) == -1 ) {
sd->status.head_top = 0;
clif->changelook(&sd->bl,LOOK_HEAD_TOP,sd->status.head_top);
}
- if(sd->status.inventory[n].equip & EQP_HEAD_MID && iPc->checkequip(sd,EQP_COSTUME_HEAD_MID) == -1 ) {
+ if(sd->status.inventory[n].equip & EQP_HEAD_MID && pc->checkequip(sd,EQP_COSTUME_HEAD_MID) == -1 ) {
sd->status.head_mid = 0;
clif->changelook(&sd->bl,LOOK_HEAD_MID,sd->status.head_mid);
}
if(sd->status.inventory[n].equip & EQP_COSTUME_HEAD_TOP) {
- sd->status.head_top = ( iPc->checkequip(sd,EQP_HEAD_TOP) >= 0 ) ? sd->inventory_data[iPc->checkequip(sd,EQP_HEAD_TOP)]->look : 0;
+ sd->status.head_top = ( pc->checkequip(sd,EQP_HEAD_TOP) >= 0 ) ? sd->inventory_data[pc->checkequip(sd,EQP_HEAD_TOP)]->look : 0;
clif->changelook(&sd->bl,LOOK_HEAD_TOP,sd->status.head_top);
}
if(sd->status.inventory[n].equip & EQP_COSTUME_HEAD_MID) {
- sd->status.head_mid = ( iPc->checkequip(sd,EQP_HEAD_MID) >= 0 ) ? sd->inventory_data[iPc->checkequip(sd,EQP_HEAD_MID)]->look : 0;
+ sd->status.head_mid = ( pc->checkequip(sd,EQP_HEAD_MID) >= 0 ) ? sd->inventory_data[pc->checkequip(sd,EQP_HEAD_MID)]->look : 0;
clif->changelook(&sd->bl,LOOK_HEAD_MID,sd->status.head_mid);
}
if(sd->status.inventory[n].equip & EQP_COSTUME_HEAD_LOW) {
- sd->status.head_bottom = ( iPc->checkequip(sd,EQP_HEAD_LOW) >= 0 ) ? sd->inventory_data[iPc->checkequip(sd,EQP_HEAD_LOW)]->look : 0;
+ sd->status.head_bottom = ( pc->checkequip(sd,EQP_HEAD_LOW) >= 0 ) ? sd->inventory_data[pc->checkequip(sd,EQP_HEAD_LOW)]->look : 0;
clif->changelook(&sd->bl,LOOK_HEAD_BOTTOM,sd->status.head_bottom);
}
if(sd->status.inventory[n].equip & EQP_SHOES)
clif->changelook(&sd->bl,LOOK_SHOES,0);
- if( sd->status.inventory[n].equip&EQP_GARMENT && iPc->checkequip(sd,EQP_COSTUME_GARMENT) == -1 ) {
+ if( sd->status.inventory[n].equip&EQP_GARMENT && pc->checkequip(sd,EQP_COSTUME_GARMENT) == -1 ) {
sd->status.robe = 0;
clif->changelook(&sd->bl, LOOK_ROBE, 0);
}
if(sd->status.inventory[n].equip & EQP_COSTUME_GARMENT) {
- sd->status.robe = ( iPc->checkequip(sd,EQP_GARMENT) >= 0 ) ? sd->inventory_data[iPc->checkequip(sd,EQP_GARMENT)]->look : 0;
+ sd->status.robe = ( pc->checkequip(sd,EQP_GARMENT) >= 0 ) ? sd->inventory_data[pc->checkequip(sd,EQP_GARMENT)]->look : 0;
clif->changelook(&sd->bl,LOOK_ROBE,sd->status.robe);
}
@@ -8818,7 +8818,7 @@ int pc_unequipitem(struct map_session_data *sd,int n,int flag) {
}
if(flag&1 || status_cacl) {
- iPc->checkallowskill(sd);
+ pc->checkallowskill(sd);
status_calc_pc(sd,0);
}
@@ -8869,7 +8869,7 @@ int pc_checkitem(struct map_session_data *sd)
if( id && !itemdb_available(id) ) {
ShowWarning("Removed invalid/disabled item id %d from inventory (amount=%d, char_id=%d).\n", id, sd->status.inventory[i].amount, sd->status.char_id);
- iPc->delitem(sd, i, sd->status.inventory[i].amount, 0, 0, LOG_TYPE_OTHER);
+ pc->delitem(sd, i, sd->status.inventory[i].amount, 0, 0, LOG_TYPE_OTHER);
}
}
@@ -8878,7 +8878,7 @@ int pc_checkitem(struct map_session_data *sd)
if( id && !itemdb_available(id) ) {
ShowWarning("Removed invalid/disabled item id %d from cart (amount=%d, char_id=%d).\n", id, sd->status.cart[i].amount, sd->status.char_id);
- iPc->cart_delitem(sd, i, sd->status.cart[i].amount, 0, LOG_TYPE_OTHER);
+ pc->cart_delitem(sd, i, sd->status.cart[i].amount, 0, LOG_TYPE_OTHER);
}
}
}
@@ -8891,8 +8891,8 @@ int pc_checkitem(struct map_session_data *sd)
if( !sd->status.inventory[i].equip )
continue;
- if( sd->status.inventory[i].equip&~iPc->equippoint(sd,i) ) {
- iPc->unequipitem(sd, i, 2);
+ if( sd->status.inventory[i].equip&~pc->equippoint(sd,i) ) {
+ pc->unequipitem(sd, i, 2);
calc_flag = 1;
continue;
}
@@ -8900,7 +8900,7 @@ int pc_checkitem(struct map_session_data *sd)
}
if( calc_flag && sd->state.active ) {
- iPc->checkallowskill(sd);
+ pc->checkallowskill(sd);
status_calc_pc(sd,0);
}
@@ -8959,8 +8959,8 @@ int pc_calc_pvprank_timer(int tid, unsigned int tick, int id, intptr_t data)
return 0;
}
- if( iPc->calc_pvprank(sd) > 0 )
- sd->pvp_timer = iTimer->add_timer(iTimer->gettick()+PVP_CALCRANK_INTERVAL,iPc->calc_pvprank_timer,id,data);
+ if( pc->calc_pvprank(sd) > 0 )
+ sd->pvp_timer = iTimer->add_timer(iTimer->gettick()+PVP_CALCRANK_INTERVAL,pc->calc_pvprank_timer,id,data);
return 0;
}
@@ -9007,7 +9007,7 @@ int pc_divorce(struct map_session_data *sd)
struct map_session_data *p_sd;
int i;
- if( sd == NULL || !iPc->ismarried(sd) )
+ if( sd == NULL || !pc->ismarried(sd) )
return -1;
if( !sd->status.partner_id )
@@ -9027,9 +9027,9 @@ int pc_divorce(struct map_session_data *sd)
for( i = 0; i < MAX_INVENTORY; i++ )
{
if( sd->status.inventory[i].nameid == WEDDING_RING_M || sd->status.inventory[i].nameid == WEDDING_RING_F )
- iPc->delitem(sd, i, 1, 0, 0, LOG_TYPE_OTHER);
+ pc->delitem(sd, i, 1, 0, 0, LOG_TYPE_OTHER);
if( p_sd->status.inventory[i].nameid == WEDDING_RING_M || p_sd->status.inventory[i].nameid == WEDDING_RING_F )
- iPc->delitem(p_sd, i, 1, 0, 0, LOG_TYPE_OTHER);
+ pc->delitem(p_sd, i, 1, 0, 0, LOG_TYPE_OTHER);
}
clif->divorced(sd, p_sd->status.name);
@@ -9043,7 +9043,7 @@ int pc_divorce(struct map_session_data *sd)
*------------------------------------------*/
struct map_session_data *pc_get_partner(struct map_session_data *sd)
{
- if (sd && iPc->ismarried(sd))
+ if (sd && pc->ismarried(sd))
// charid2sd returns NULL if not found
return iMap->charid2sd(sd->status.partner_id);
@@ -9079,7 +9079,7 @@ struct map_session_data *pc_get_mother (struct map_session_data *sd)
*------------------------------------------*/
struct map_session_data *pc_get_child (struct map_session_data *sd)
{
- if (sd && iPc->ismarried(sd) && sd->status.child > 0)
+ if (sd && pc->ismarried(sd) && sd->status.child > 0)
// charid2sd returns NULL if not found
return iMap->charid2sd(sd->status.child);
@@ -9277,7 +9277,7 @@ void pc_overheat(struct map_session_data *sd, int val) {
if( !pc_ismadogear(sd) || sd->sc.data[SC_OVERHEAT] )
return; // already burning
- skill = cap_value(iPc->checkskill(sd,NC_MAINFRAME),0,4);
+ skill = cap_value(pc->checkskill(sd,NC_MAINFRAME),0,4);
if( sd->sc.data[SC_OVERHEAT_LIMITPOINT] ) {
heat += sd->sc.data[SC_OVERHEAT_LIMITPOINT]->val1;
status_change_end(&sd->bl,SC_OVERHEAT_LIMITPOINT,INVALID_TIMER);
@@ -9531,7 +9531,7 @@ static bool pc_readdb_skilltree(char* fields[], int columns, int current)
ShowWarning("pc_readdb_skilltree: Invalid job class %d specified.\n", class_);
return false;
}
- idx = iPc->class2idx(class_);
+ idx = pc->class2idx(class_);
//This is to avoid adding two lines for the same skill. [Skotlex]
ARR_FIND( 0, MAX_SKILL_TREE, skill_idx, skill_tree[idx][skill_idx].id == 0 || skill_tree[idx][skill_idx].id == skill_id );
@@ -9638,7 +9638,7 @@ int pc_readdb(void)
maxlv = MAX_LEVEL;
}
count++;
- job = jobs[0] = iPc->class2idx(job_id);
+ job = jobs[0] = pc->class2idx(job_id);
//We send one less and then one more because the last entry in the exp array should hold 0.
max_level[job][type] = pc_split_atoui(split[3], exp_table[job][type],',',maxlv-1)+1;
//Reverse check in case the array has a bunch of trailing zeros... [Skotlex]
@@ -9663,7 +9663,7 @@ int pc_readdb(void)
ShowError("pc_readdb: Invalid job ID %d.\n", job_id);
continue;
}
- job = iPc->class2idx(job_id);
+ job = pc->class2idx(job_id);
memcpy(exp_table[job][type], exp_table[jobs[0]][type], sizeof(exp_table[0][0]));
max_level[job][type] = maxlv;
// ShowDebug("%s - Class %d: %u\n", type?"Job":"Base", job_id, max_level[job][type]);
@@ -9674,11 +9674,11 @@ int pc_readdb(void)
if (!pcdb_checkid(i)) continue;
if (i == JOB_WEDDING || i == JOB_XMAS || i == JOB_SUMMER)
continue; //Classes that do not need exp tables.
- j = iPc->class2idx(i);
+ j = pc->class2idx(i);
if (!max_level[j][0])
- ShowWarning("Class %s (%d) does not has a base exp table.\n", iPc->job_name(i), i);
+ ShowWarning("Class %s (%d) does not has a base exp table.\n", pc->job_name(i), i);
if (!max_level[j][1])
- ShowWarning("Class %s (%d) does not has a job exp table.\n", iPc->job_name(i), i);
+ ShowWarning("Class %s (%d) does not has a job exp table.\n", pc->job_name(i), i);
}
ShowStatus("Done reading '"CL_WHITE"%lu"CL_RESET"' entries in '"CL_WHITE"%s/"DBPATH"%s"CL_RESET"'.\n",count,iMap->db_path,"exp.txt");
count = 0;
@@ -9784,10 +9784,10 @@ int pc_readdb(void)
}
// generate the remaining parts of the db if necessary
k = battle_config.use_statpoint_table; //save setting
- battle_config.use_statpoint_table = 0; //temporarily disable to force iPc->gets_status_point use default values
+ battle_config.use_statpoint_table = 0; //temporarily disable to force pc->gets_status_point use default values
statp[0] = 45; // seed value
for (; i <= MAX_LEVEL; i++)
- statp[i] = statp[i-1] + iPc->gets_status_point(i-1);
+ statp[i] = statp[i-1] + pc->gets_status_point(i-1);
battle_config.use_statpoint_table = k; //restore setting
return 0;
@@ -9844,16 +9844,16 @@ int do_init_pc(void) {
itemcd_db = idb_alloc(DB_OPT_RELEASE_DATA);
- iPc->readdb();
+ pc->readdb();
iTimer->add_timer_func_list(pc_invincible_timer, "pc_invincible_timer");
iTimer->add_timer_func_list(pc_eventtimer, "pc_eventtimer");
iTimer->add_timer_func_list(pc_inventory_rental_end, "pc_inventory_rental_end");
- iTimer->add_timer_func_list(iPc->calc_pvprank_timer, "iPc->calc_pvprank_timer");
+ iTimer->add_timer_func_list(pc->calc_pvprank_timer, "pc->calc_pvprank_timer");
iTimer->add_timer_func_list(pc_autosave, "pc_autosave");
iTimer->add_timer_func_list(pc_spiritball_timer, "pc_spiritball_timer");
iTimer->add_timer_func_list(pc_follow_timer, "pc_follow_timer");
- iTimer->add_timer_func_list(iPc->endautobonus, "iPc->endautobonus");
+ iTimer->add_timer_func_list(pc->endautobonus, "pc->endautobonus");
iTimer->add_timer_func_list(pc_talisman_timer, "pc_talisman_timer");
iTimer->add_timer(iTimer->gettick() + iMap->autosave_interval, pc_autosave, 0, 0);
@@ -9865,11 +9865,11 @@ int do_init_pc(void) {
int day_duration = battle_config.day_duration;
int night_duration = battle_config.night_duration;
// add night/day timer [Yor]
- iTimer->add_timer_func_list(iPc->map_day_timer, "iPc->map_day_timer");
- iTimer->add_timer_func_list(iPc->map_night_timer, "iPc->map_night_timer");
+ iTimer->add_timer_func_list(pc->map_day_timer, "pc->map_day_timer");
+ iTimer->add_timer_func_list(pc->map_night_timer, "pc->map_night_timer");
- iPc->day_timer_tid = iTimer->add_timer_interval(iTimer->gettick() + (iMap->night_flag ? 0 : day_duration) + night_duration, iPc->map_day_timer, 0, 0, day_duration + night_duration);
- iPc->night_timer_tid = iTimer->add_timer_interval(iTimer->gettick() + day_duration + (iMap->night_flag ? night_duration : 0), iPc->map_night_timer, 0, 0, day_duration + night_duration);
+ pc->day_timer_tid = iTimer->add_timer_interval(iTimer->gettick() + (iMap->night_flag ? 0 : day_duration) + night_duration, pc->map_day_timer, 0, 0, day_duration + night_duration);
+ pc->night_timer_tid = iTimer->add_timer_interval(iTimer->gettick() + day_duration + (iMap->night_flag ? night_duration : 0), pc->map_night_timer, 0, 0, day_duration + night_duration);
}
do_init_pc_groups();
@@ -9885,211 +9885,213 @@ int do_init_pc(void) {
* created by Susu
*-------------------------------------*/
void pc_defaults(void) {
- iPc = &iPc_s;
+ pc = &pc_s;
/* vars */
// timer for night.day
- iPc->day_timer_tid = day_timer_tid;
- iPc->night_timer_tid = night_timer_tid;
+ pc->day_timer_tid = day_timer_tid;
+ pc->night_timer_tid = night_timer_tid;
/* funcs */
- iPc->class2idx = pc_class2idx;
- iPc->get_group_level = pc_get_group_level;
- iPc->can_give_items = pc_can_give_items;
+ pc->class2idx = pc_class2idx;
+ pc->get_group_level = pc_get_group_level;
+ pc->can_give_items = pc_can_give_items;
- iPc->can_use_command = pc_can_use_command;
+ pc->can_use_command = pc_can_use_command;
- iPc->setrestartvalue = pc_setrestartvalue;
- iPc->makesavestatus = pc_makesavestatus;
- iPc->respawn = pc_respawn;
- iPc->setnewpc = pc_setnewpc;
- iPc->authok = pc_authok;
- iPc->authfail = pc_authfail;
- iPc->reg_received = pc_reg_received;
+ pc->setrestartvalue = pc_setrestartvalue;
+ pc->makesavestatus = pc_makesavestatus;
+ pc->respawn = pc_respawn;
+ pc->setnewpc = pc_setnewpc;
+ pc->authok = pc_authok;
+ pc->authfail = pc_authfail;
+ pc->reg_received = pc_reg_received;
- iPc->isequip = pc_isequip;
- iPc->equippoint = pc_equippoint;
- iPc->setinventorydata = pc_setinventorydata;
+ pc->isequip = pc_isequip;
+ pc->equippoint = pc_equippoint;
+ pc->setinventorydata = pc_setinventorydata;
- iPc->checkskill = pc_checkskill;
- iPc->checkskill2 = pc_checkskill2;
- iPc->checkallowskill = pc_checkallowskill;
- iPc->checkequip = pc_checkequip;
+ pc->checkskill = pc_checkskill;
+ pc->checkskill2 = pc_checkskill2;
+ pc->checkallowskill = pc_checkallowskill;
+ pc->checkequip = pc_checkequip;
- iPc->calc_skilltree = pc_calc_skilltree;
- iPc->calc_skilltree_normalize_job = pc_calc_skilltree_normalize_job;
- iPc->clean_skilltree = pc_clean_skilltree;
+ pc->calc_skilltree = pc_calc_skilltree;
+ pc->calc_skilltree_normalize_job = pc_calc_skilltree_normalize_job;
+ pc->clean_skilltree = pc_clean_skilltree;
- iPc->setpos = pc_setpos;
- iPc->setsavepoint = pc_setsavepoint;
- iPc->randomwarp = pc_randomwarp;
- iPc->memo = pc_memo;
+ pc->setpos = pc_setpos;
+ pc->setsavepoint = pc_setsavepoint;
+ pc->randomwarp = pc_randomwarp;
+ pc->memo = pc_memo;
- iPc->checkadditem = pc_checkadditem;
- iPc->inventoryblank = pc_inventoryblank;
- iPc->search_inventory = pc_search_inventory;
- iPc->payzeny = pc_payzeny;
- iPc->additem = pc_additem;
- iPc->getzeny = pc_getzeny;
- iPc->delitem = pc_delitem;
+ pc->checkadditem = pc_checkadditem;
+ pc->inventoryblank = pc_inventoryblank;
+ pc->search_inventory = pc_search_inventory;
+ pc->payzeny = pc_payzeny;
+ pc->additem = pc_additem;
+ pc->getzeny = pc_getzeny;
+ pc->delitem = pc_delitem;
// Special Shop System
- iPc->paycash = pc_paycash;
- iPc->getcash = pc_getcash;
+ pc->paycash = pc_paycash;
+ pc->getcash = pc_getcash;
- iPc->cart_additem = pc_cart_additem;
- iPc->cart_delitem = pc_cart_delitem;
- iPc->putitemtocart = pc_putitemtocart;
- iPc->getitemfromcart = pc_getitemfromcart;
- iPc->cartitem_amount = pc_cartitem_amount;
+ pc->cart_additem = pc_cart_additem;
+ pc->cart_delitem = pc_cart_delitem;
+ pc->putitemtocart = pc_putitemtocart;
+ pc->getitemfromcart = pc_getitemfromcart;
+ pc->cartitem_amount = pc_cartitem_amount;
- iPc->takeitem = pc_takeitem;
- iPc->dropitem = pc_dropitem;
+ pc->takeitem = pc_takeitem;
+ pc->dropitem = pc_dropitem;
- iPc->isequipped = pc_isequipped;
- iPc->can_Adopt = pc_can_Adopt;
- iPc->adoption = pc_adoption;
+ pc->isequipped = pc_isequipped;
+ pc->can_Adopt = pc_can_Adopt;
+ pc->adoption = pc_adoption;
- iPc->updateweightstatus = pc_updateweightstatus;
+ pc->updateweightstatus = pc_updateweightstatus;
- iPc->addautobonus = pc_addautobonus;
- iPc->exeautobonus = pc_exeautobonus;
- iPc->endautobonus = pc_endautobonus;
- iPc->delautobonus = pc_delautobonus;
+ pc->addautobonus = pc_addautobonus;
+ pc->exeautobonus = pc_exeautobonus;
+ pc->endautobonus = pc_endautobonus;
+ pc->delautobonus = pc_delautobonus;
- iPc->bonus = pc_bonus;
- iPc->bonus2 = pc_bonus2;
- iPc->bonus3 = pc_bonus3;
- iPc->bonus4 = pc_bonus4;
- iPc->bonus5 = pc_bonus5;
- iPc->skill = pc_skill;
+ pc->bonus = pc_bonus;
+ pc->bonus2 = pc_bonus2;
+ pc->bonus3 = pc_bonus3;
+ pc->bonus4 = pc_bonus4;
+ pc->bonus5 = pc_bonus5;
+ pc->skill = pc_skill;
- iPc->insert_card = pc_insert_card;
+ pc->insert_card = pc_insert_card;
- iPc->steal_item = pc_steal_item;
- iPc->steal_coin = pc_steal_coin;
+ pc->steal_item = pc_steal_item;
+ pc->steal_coin = pc_steal_coin;
- iPc->modifybuyvalue = pc_modifybuyvalue;
- iPc->modifysellvalue = pc_modifysellvalue;
+ pc->modifybuyvalue = pc_modifybuyvalue;
+ pc->modifysellvalue = pc_modifysellvalue;
- iPc->follow = pc_follow; // [MouseJstr]
- iPc->stop_following = pc_stop_following;
+ pc->follow = pc_follow; // [MouseJstr]
+ pc->stop_following = pc_stop_following;
- iPc->maxbaselv = pc_maxbaselv;
- iPc->maxjoblv = pc_maxjoblv;
- iPc->checkbaselevelup = pc_checkbaselevelup;
- iPc->checkjoblevelup = pc_checkjoblevelup;
- iPc->gainexp = pc_gainexp;
- iPc->nextbaseexp = pc_nextbaseexp;
- iPc->thisbaseexp = pc_thisbaseexp;
- iPc->nextjobexp = pc_nextjobexp;
- iPc->thisjobexp = pc_thisjobexp;
- iPc->gets_status_point = pc_gets_status_point;
- iPc->need_status_point = pc_need_status_point;
- iPc->statusup = pc_statusup;
- iPc->statusup2 = pc_statusup2;
- iPc->skillup = pc_skillup;
- iPc->allskillup = pc_allskillup;
- iPc->resetlvl = pc_resetlvl;
- iPc->resetstate = pc_resetstate;
- iPc->resetskill = pc_resetskill;
- iPc->resetfeel = pc_resetfeel;
- iPc->resethate = pc_resethate;
- iPc->equipitem = pc_equipitem;
- iPc->unequipitem = pc_unequipitem;
- iPc->checkitem = pc_checkitem;
- iPc->useitem = pc_useitem;
+ pc->maxbaselv = pc_maxbaselv;
+ pc->maxjoblv = pc_maxjoblv;
+ pc->checkbaselevelup = pc_checkbaselevelup;
+ pc->checkjoblevelup = pc_checkjoblevelup;
+ pc->gainexp = pc_gainexp;
+ pc->nextbaseexp = pc_nextbaseexp;
+ pc->thisbaseexp = pc_thisbaseexp;
+ pc->nextjobexp = pc_nextjobexp;
+ pc->thisjobexp = pc_thisjobexp;
+ pc->gets_status_point = pc_gets_status_point;
+ pc->need_status_point = pc_need_status_point;
+ pc->statusup = pc_statusup;
+ pc->statusup2 = pc_statusup2;
+ pc->skillup = pc_skillup;
+ pc->allskillup = pc_allskillup;
+ pc->resetlvl = pc_resetlvl;
+ pc->resetstate = pc_resetstate;
+ pc->resetskill = pc_resetskill;
+ pc->resetfeel = pc_resetfeel;
+ pc->resethate = pc_resethate;
+ pc->equipitem = pc_equipitem;
+ pc->unequipitem = pc_unequipitem;
+ pc->checkitem = pc_checkitem;
+ pc->useitem = pc_useitem;
- iPc->skillatk_bonus = pc_skillatk_bonus;
- iPc->skillheal_bonus = pc_skillheal_bonus;
- iPc->skillheal2_bonus = pc_skillheal2_bonus;
+ pc->skillatk_bonus = pc_skillatk_bonus;
+ pc->skillheal_bonus = pc_skillheal_bonus;
+ pc->skillheal2_bonus = pc_skillheal2_bonus;
- iPc->damage = pc_damage;
- iPc->dead = pc_dead;
- iPc->revive = pc_revive;
- iPc->heal = pc_heal;
- iPc->itemheal = pc_itemheal;
- iPc->percentheal = pc_percentheal;
- iPc->jobchange = pc_jobchange;
- iPc->setoption = pc_setoption;
- iPc->setcart = pc_setcart;
- iPc->setfalcon = pc_setfalcon;
- iPc->setriding = pc_setriding;
- iPc->setmadogear = pc_setmadogear;
- iPc->changelook = pc_changelook;
- iPc->equiplookall = pc_equiplookall;
+ pc->damage = pc_damage;
+ pc->dead = pc_dead;
+ pc->revive = pc_revive;
+ pc->heal = pc_heal;
+ pc->itemheal = pc_itemheal;
+ pc->percentheal = pc_percentheal;
+ pc->jobchange = pc_jobchange;
+ pc->setoption = pc_setoption;
+ pc->setcart = pc_setcart;
+ pc->setfalcon = pc_setfalcon;
+ pc->setriding = pc_setriding;
+ pc->setmadogear = pc_setmadogear;
+ pc->changelook = pc_changelook;
+ pc->equiplookall = pc_equiplookall;
- iPc->readparam = pc_readparam;
- iPc->setparam = pc_setparam;
- iPc->readreg = pc_readreg;
- iPc->setreg = pc_setreg;
- iPc->readregstr = pc_readregstr;
- iPc->setregstr = pc_setregstr;
- iPc->readregistry = pc_readregistry;
- iPc->setregistry = pc_setregistry;
- iPc->readregistry_str = pc_readregistry_str;
- iPc->setregistry_str = pc_setregistry_str;
+ pc->readparam = pc_readparam;
+ pc->setparam = pc_setparam;
+ pc->readreg = pc_readreg;
+ pc->setreg = pc_setreg;
+ pc->readregstr = pc_readregstr;
+ pc->setregstr = pc_setregstr;
+ pc->readregistry = pc_readregistry;
+ pc->setregistry = pc_setregistry;
+ pc->readregistry_str = pc_readregistry_str;
+ pc->setregistry_str = pc_setregistry_str;
- iPc->addeventtimer = pc_addeventtimer;
- iPc->deleventtimer = pc_deleventtimer;
- iPc->cleareventtimer = pc_cleareventtimer;
- iPc->addeventtimercount = pc_addeventtimercount;
+ pc->addeventtimer = pc_addeventtimer;
+ pc->deleventtimer = pc_deleventtimer;
+ pc->cleareventtimer = pc_cleareventtimer;
+ pc->addeventtimercount = pc_addeventtimercount;
- iPc->calc_pvprank = pc_calc_pvprank;
- iPc->calc_pvprank_timer = pc_calc_pvprank_timer;
+ pc->calc_pvprank = pc_calc_pvprank;
+ pc->calc_pvprank_timer = pc_calc_pvprank_timer;
- iPc->ismarried = pc_ismarried;
- iPc->marriage = pc_marriage;
- iPc->divorce = pc_divorce;
- iPc->get_partner = pc_get_partner;
- iPc->get_father = pc_get_father;
- iPc->get_mother = pc_get_mother;
- iPc->get_child = pc_get_child;
+ pc->ismarried = pc_ismarried;
+ pc->marriage = pc_marriage;
+ pc->divorce = pc_divorce;
+ pc->get_partner = pc_get_partner;
+ pc->get_father = pc_get_father;
+ pc->get_mother = pc_get_mother;
+ pc->get_child = pc_get_child;
- iPc->bleeding = pc_bleeding;
- iPc->regen = pc_regen;
+ pc->bleeding = pc_bleeding;
+ pc->regen = pc_regen;
- iPc->setstand = pc_setstand;
- iPc->candrop = pc_candrop;
+ pc->setstand = pc_setstand;
+ pc->candrop = pc_candrop;
- iPc->jobid2mapid = pc_jobid2mapid; // Skotlex
- iPc->mapid2jobid = pc_mapid2jobid; // Skotlex
+ pc->jobid2mapid = pc_jobid2mapid; // Skotlex
+ pc->mapid2jobid = pc_mapid2jobid; // Skotlex
- iPc->job_name = job_name;
+ pc->job_name = job_name;
- iPc->setinvincibletimer = pc_setinvincibletimer;
- iPc->delinvincibletimer = pc_delinvincibletimer;
+ pc->setinvincibletimer = pc_setinvincibletimer;
+ pc->delinvincibletimer = pc_delinvincibletimer;
- iPc->addspiritball = pc_addspiritball;
- iPc->delspiritball = pc_delspiritball;
- iPc->addfame = pc_addfame;
- iPc->famerank = pc_famerank;
- iPc->set_hate_mob = pc_set_hate_mob;
+ pc->addspiritball = pc_addspiritball;
+ pc->delspiritball = pc_delspiritball;
+ pc->addfame = pc_addfame;
+ pc->famerank = pc_famerank;
+ pc->set_hate_mob = pc_set_hate_mob;
- iPc->readdb = pc_readdb;
- iPc->do_init_pc = do_init_pc;
- iPc->do_final_pc = do_final_pc;
- iPc->map_day_timer = map_day_timer; // by [yor]
- iPc->map_night_timer = map_night_timer; // by [yor]
+ pc->readdb = pc_readdb;
+ pc->do_init_pc = do_init_pc;
+ pc->do_final_pc = do_final_pc;
+ pc->map_day_timer = map_day_timer; // by [yor]
+ pc->map_night_timer = map_night_timer; // by [yor]
// Rental System
- iPc->inventory_rentals = pc_inventory_rentals;
- iPc->inventory_rental_clear = pc_inventory_rental_clear;
- iPc->inventory_rental_add = pc_inventory_rental_add;
+ pc->inventory_rentals = pc_inventory_rentals;
+ pc->inventory_rental_clear = pc_inventory_rental_clear;
+ pc->inventory_rental_add = pc_inventory_rental_add;
- iPc->disguise = pc_disguise;
- iPc->isautolooting = pc_isautolooting;
+ pc->disguise = pc_disguise;
+ pc->isautolooting = pc_isautolooting;
- iPc->overheat = pc_overheat;
+ pc->overheat = pc_overheat;
- iPc->banding = pc_banding;
+ pc->banding = pc_banding;
- iPc->itemcd_do = pc_itemcd_do;
+ pc->itemcd_do = pc_itemcd_do;
- iPc->load_combo = pc_load_combo;
+ pc->load_combo = pc_load_combo;
- iPc->add_talisman = pc_add_talisman;
- iPc->del_talisman = pc_del_talisman;
+ pc->add_talisman = pc_add_talisman;
+ pc->del_talisman = pc_del_talisman;
- iPc->baselevelchanged = pc_baselevelchanged;
- iPc->level_penalty_mod = pc_level_penalty_mod;
+ pc->baselevelchanged = pc_baselevelchanged;
+#if defined(RENEWAL_DROP) || defined(RENEWAL_EXP)
+ pc->level_penalty_mod = pc_level_penalty_mod;
+#endif
}
diff --git a/src/map/pc.h b/src/map/pc.h
index 91f7750b3..ebf474823 100644
--- a/src/map/pc.h
+++ b/src/map/pc.h
@@ -683,49 +683,21 @@ enum equip_pos {
#define pc_has_permission(sd, permission) ( ((sd)->permissions&permission) != 0 )
#define pc_should_log_commands(sd) ( (sd)->group_log_command != false )
-
-
-
-
#define pc_checkoverhp(sd) ((sd)->battle_status.hp == (sd)->battle_status.max_hp)
#define pc_checkoversp(sd) ((sd)->battle_status.sp == (sd)->battle_status.max_sp)
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-#define pc_readglobalreg(sd,reg) iPc->readregistry(sd,reg,3)
-#define pc_setglobalreg(sd,reg,val) iPc->setregistry(sd,reg,val,3)
-#define pc_readglobalreg_str(sd,reg) iPc->readregistry_str(sd,reg,3)
-#define pc_setglobalreg_str(sd,reg,val) iPc->setregistry_str(sd,reg,val,3)
-#define pc_readaccountreg(sd,reg) iPc->readregistry(sd,reg,2)
-#define pc_setaccountreg(sd,reg,val) iPc->setregistry(sd,reg,val,2)
-#define pc_readaccountregstr(sd,reg) iPc->readregistry_str(sd,reg,2)
-#define pc_setaccountregstr(sd,reg,val) iPc->setregistry_str(sd,reg,val,2)
-#define pc_readaccountreg2(sd,reg) iPc->readregistry(sd,reg,1)
-#define pc_setaccountreg2(sd,reg,val) iPc->setregistry(sd,reg,val,1)
-#define pc_readaccountreg2str(sd,reg) iPc->readregistry_str(sd,reg,1)
-#define pc_setaccountreg2str(sd,reg,val) iPc->setregistry_str(sd,reg,val,1)
-
-
-
-
-
-
-
+#define pc_readglobalreg(sd,reg) pc->readregistry(sd,reg,3)
+#define pc_setglobalreg(sd,reg,val) pc->setregistry(sd,reg,val,3)
+#define pc_readglobalreg_str(sd,reg) pc->readregistry_str(sd,reg,3)
+#define pc_setglobalreg_str(sd,reg,val) pc->setregistry_str(sd,reg,val,3)
+#define pc_readaccountreg(sd,reg) pc->readregistry(sd,reg,2)
+#define pc_setaccountreg(sd,reg,val) pc->setregistry(sd,reg,val,2)
+#define pc_readaccountregstr(sd,reg) pc->readregistry_str(sd,reg,2)
+#define pc_setaccountregstr(sd,reg,val) pc->setregistry_str(sd,reg,val,2)
+#define pc_readaccountreg2(sd,reg) pc->readregistry(sd,reg,1)
+#define pc_setaccountreg2(sd,reg,val) pc->setregistry(sd,reg,val,1)
+#define pc_readaccountreg2str(sd,reg) pc->readregistry_str(sd,reg,1)
+#define pc_setaccountreg2str(sd,reg,val) pc->setregistry_str(sd,reg,val,1)
struct skill_tree_entry {
short id;
@@ -758,15 +730,6 @@ extern struct fame_list taekwon_fame_list[MAX_FAME_LIST];
enum {ADDITEM_EXIST,ADDITEM_NEW,ADDITEM_OVERAMOUNT};
-
-
-
-
-
-
-
-
-
#if defined(RENEWAL_DROP) || defined(RENEWAL_EXP)
#endif
/*=====================================
@@ -981,10 +944,12 @@ struct pc_interface {
int (*del_talisman) (struct map_session_data *sd,int count,int type);
void (*baselevelchanged) (struct map_session_data *sd);
+#if defined(RENEWAL_DROP) || defined(RENEWAL_EXP)
int (*level_penalty_mod) (struct map_session_data *sd, struct mob_data * md, int type);
-} iPc_s;
+#endif
+} pc_s;
-struct pc_interface *iPc;
+struct pc_interface *pc;
void pc_defaults(void);
diff --git a/src/map/pc_groups.c b/src/map/pc_groups.c
index 1a83c8b63..f1f69f7cb 100644
--- a/src/map/pc_groups.c
+++ b/src/map/pc_groups.c
@@ -414,6 +414,19 @@ int pc_group_id2level(int group_id)
return 0;
return group->level;
}
+/**
+ * Group ID -> group level lookup.
+ * @param group id
+ * @return group index
+ * @public
+ */
+int pc_group_id2idx(int group_id)
+{
+ GroupSettings *group = id2group(group_id);
+ if (group == NULL)
+ return 0;
+ return group->group_pos;
+}
/**
* Initialize PC Groups: allocate DBMaps and read config.
diff --git a/src/map/pc_groups.h b/src/map/pc_groups.h
index 26cd8f39f..0ce7b0d51 100644
--- a/src/map/pc_groups.h
+++ b/src/map/pc_groups.h
@@ -15,6 +15,7 @@ bool pc_group_has_permission(int group_id, int permission);
bool pc_group_should_log_commands(int group_id);
const char* pc_group_id2name(int group_id);
int pc_group_id2level(int group_id);
+int pc_group_id2idx(int group_id);
void pc_group_pc_load(struct map_session_data *);
void do_init_pc_groups(void);
diff --git a/src/map/pet.c b/src/map/pet.c
index fa5188e79..00402f9d4 100644
--- a/src/map/pet.c
+++ b/src/map/pet.c
@@ -76,7 +76,7 @@ int pet_create_egg(struct map_session_data *sd, int item_id)
{
int pet_id = search_petDB_index(item_id, PET_EGG);
if (pet_id < 0) return 0; //No pet egg here.
- if (!iPc->inventoryblank(sd)) return 0; // Inventory full
+ if (!pc->inventoryblank(sd)) return 0; // Inventory full
sd->catch_target_class = pet_db[pet_id].class_;
intif_create_pet(sd->status.account_id, sd->status.char_id,
(short)pet_db[pet_id].class_,
@@ -304,7 +304,7 @@ static int pet_return_egg(struct map_session_data *sd, struct pet_data *pd)
tmp_item.card[1] = GetWord(pd->pet.pet_id,0);
tmp_item.card[2] = GetWord(pd->pet.pet_id,1);
tmp_item.card[3] = pd->pet.rename_flag;
- if((flag = iPc->additem(sd,&tmp_item,1,LOG_TYPE_OTHER))) {
+ if((flag = pc->additem(sd,&tmp_item,1,LOG_TYPE_OTHER))) {
clif->additem(sd,0,0,flag);
iMap->addflooritem(&tmp_item,1,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0);
}
@@ -448,7 +448,7 @@ int pet_recv_petdata(int account_id,struct s_pet *p,int flag)
return 1;
}
if (!pet_birth_process(sd,p)) //Pet hatched. Delete egg.
- iPc->delitem(sd,i,1,0,0,LOG_TYPE_OTHER);
+ pc->delitem(sd,i,1,0,0,LOG_TYPE_OTHER);
} else {
pet_data_init(sd,p);
if(sd->pd && sd->bl.prev != NULL) {
@@ -569,7 +569,7 @@ int pet_get_egg(int account_id,int pet_id,int flag)
tmp_item.card[1] = GetWord(pet_id,0);
tmp_item.card[2] = GetWord(pet_id,1);
tmp_item.card[3] = 0; //New pets are not named.
- if((ret = iPc->additem(sd,&tmp_item,1,LOG_TYPE_PICKDROP_PLAYER))) {
+ if((ret = pc->additem(sd,&tmp_item,1,LOG_TYPE_PICKDROP_PLAYER))) {
clif->additem(sd,0,0,ret);
iMap->addflooritem(&tmp_item,1,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0);
}
@@ -594,7 +594,7 @@ int pet_menu(struct map_session_data *sd,int menunum)
egg_id = itemdb_exists(sd->pd->petDB->EggID);
if (egg_id) {
- if ((egg_id->flag.trade_restriction&0x01) && !iPc->inventoryblank(sd)) {
+ if ((egg_id->flag.trade_restriction&0x01) && !pc->inventoryblank(sd)) {
clif->message(sd->fd, msg_txt(451)); // You can't return your pet because your inventory is full.
return 1;
}
@@ -674,7 +674,7 @@ int pet_equipitem(struct map_session_data *sd,int index)
return 1;
}
- iPc->delitem(sd,index,1,0,0,LOG_TYPE_OTHER);
+ pc->delitem(sd,index,1,0,0,LOG_TYPE_OTHER);
pd->pet.equip = nameid;
status_set_viewdata(&pd->bl, pd->pet.class_); //Updates view_data.
clif->send_petdata(NULL, sd->pd, 3, sd->pd->vd.head_bottom);
@@ -710,7 +710,7 @@ static int pet_unequipitem(struct map_session_data *sd, struct pet_data *pd)
memset(&tmp_item,0,sizeof(tmp_item));
tmp_item.nameid = nameid;
tmp_item.identify = 1;
- if((flag = iPc->additem(sd,&tmp_item,1,LOG_TYPE_OTHER))) {
+ if((flag = pc->additem(sd,&tmp_item,1,LOG_TYPE_OTHER))) {
clif->additem(sd,0,0,flag);
iMap->addflooritem(&tmp_item,1,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0);
}
@@ -744,12 +744,12 @@ static int pet_food(struct map_session_data *sd, struct pet_data *pd)
int i,k;
k=pd->petDB->FoodID;
- i=iPc->search_inventory(sd,k);
+ i=pc->search_inventory(sd,k);
if(i < 0) {
clif->pet_food(sd,k,0);
return 1;
}
- iPc->delitem(sd,i,1,0,0,LOG_TYPE_CONSUME);
+ pc->delitem(sd,i,1,0,0,LOG_TYPE_CONSUME);
if( pd->pet.hungry > 90 )
pet_set_intimate(pd, pd->pet.intimate - pd->petDB->r_full);
@@ -1021,7 +1021,7 @@ int pet_lootitem_drop(struct pet_data *pd,struct map_session_data *sd)
for(i=0;i<pd->loot->count;i++) {
it = &pd->loot->item[i];
if(sd){
- if((flag = iPc->additem(sd,it,it->amount,LOG_TYPE_PICKDROP_PLAYER))){
+ if((flag = pc->additem(sd,it,it->amount,LOG_TYPE_PICKDROP_PLAYER))){
clif->additem(sd,0,0,flag);
ditem = ers_alloc(item_drop_ers, struct item_drop);
memcpy(&ditem->item_data, it, sizeof(struct item));
diff --git a/src/map/script.c b/src/map/script.c
index 9569e526d..d58e3780e 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -89,26 +89,6 @@ static inline void SETVALUE(unsigned char* buf, int i, int n)
buf[i+2] = GetByte(n, 2);
}
-// String buffer structures.
-// str_data stores string information
-static struct str_data_struct {
- enum c_op type;
- int str;
- int backpatch;
- int label;
- bool (*func)(struct script_state *st);
- int val;
- int next;
-} *str_data = NULL;
-static int str_data_size = 0; // size of the data
-static int str_num = LABEL_START; // next id to be assigned
-
-// str_buf holds the strings themselves
-static char *str_buf;
-static int str_size = 0; // size of the buffer
-static int str_pos = 0; // next position to be assigned
-
-
// Using a prime number for SCRIPT_HASH_SIZE should give better distributions
#define SCRIPT_HASH_SIZE 1021
int str_hash[SCRIPT_HASH_SIZE];
@@ -338,7 +318,7 @@ static void script_dump_stack(struct script_state* st)
break;
case C_NAME:
- ShowMessage(" \"%s\" (id=%d ref=%p subtype=%s)\n", reference_getname(data), data->u.num, data->ref, script_op2name(str_data[data->u.num].type));
+ ShowMessage(" \"%s\" (id=%d ref=%p subtype=%s)\n", reference_getname(data), data->u.num, data->ref, script_op2name(script->str_data[data->u.num].type));
break;
case C_RETINFO:
@@ -416,7 +396,7 @@ static void script_reportdata(struct script_data* data)
ShowDebug("Data: param name='%s' type=%d\n", reference_getname(data), reference_getparamtype(data));
} else {// ???
ShowDebug("Data: reference name='%s' type=%s\n", reference_getname(data), script_op2name(data->type));
- ShowDebug("Please report this!!! - str_data.type=%s\n", script_op2name(str_data[reference_getid(data)].type));
+ ShowDebug("Please report this!!! - script->str_data.type=%s\n", script_op2name(script->str_data[reference_getid(data)].type));
}
break;
case C_POS:// label
@@ -442,7 +422,7 @@ static void script_reportfunc(struct script_state* st)
data = script_getdata(st,0);
- if( !data_isreference(data) || str_data[reference_getid(data)].type != C_FUNC )
+ if( !data_isreference(data) || script->str_data[reference_getid(data)].type != C_FUNC )
{// script currently not executing a built-in function or corrupt stack
return;
}
@@ -526,14 +506,14 @@ static unsigned int calc_hash(const char* p)
/*==========================================
- * str_data manipulation functions
+ * script->str_data manipulation functions
*------------------------------------------*/
/// Looks up string using the provided id.
const char* get_str(int id)
{
- Assert( id >= LABEL_START && id < str_size );
- return str_buf+str_data[id].str;
+ Assert( id >= LABEL_START && id < script->str_size );
+ return script->str_buf+script->str_data[id].str;
}
/// Returns the uid of the string, or -1.
@@ -541,7 +521,7 @@ static int search_str(const char* p)
{
int i;
- for( i = str_hash[calc_hash(p)]; i != 0; i = str_data[i].next )
+ for( i = str_hash[calc_hash(p)]; i != 0; i = script->str_data[i].next )
if( strcasecmp(get_str(i),p) == 0 )
return i;
@@ -559,50 +539,50 @@ int add_str(const char* p)
if( str_hash[h] == 0 )
{// empty bucket, add new node here
- str_hash[h] = str_num;
+ str_hash[h] = script->str_num;
}
else
{// scan for end of list, or occurence of identical string
- for( i = str_hash[h]; ; i = str_data[i].next )
+ for( i = str_hash[h]; ; i = script->str_data[i].next )
{
if( strcasecmp(get_str(i),p) == 0 )
return i; // string already in list
- if( str_data[i].next == 0 )
+ if( script->str_data[i].next == 0 )
break; // reached the end
}
// append node to end of list
- str_data[i].next = str_num;
+ script->str_data[i].next = script->str_num;
}
// grow list if neccessary
- if( str_num >= str_data_size )
+ if( script->str_num >= script->str_data_size )
{
- str_data_size += 128;
- RECREATE(str_data,struct str_data_struct,str_data_size);
- memset(str_data + (str_data_size - 128), '\0', 128);
+ script->str_data_size += 128;
+ RECREATE(script->str_data,struct str_data_struct,script->str_data_size);
+ memset(script->str_data + (script->str_data_size - 128), '\0', 128);
}
len=(int)strlen(p);
// grow string buffer if neccessary
- while( str_pos+len+1 >= str_size )
+ while( script->str_pos+len+1 >= script->str_size )
{
- str_size += 256;
- RECREATE(str_buf,char,str_size);
- memset(str_buf + (str_size - 256), '\0', 256);
+ script->str_size += 256;
+ RECREATE(script->str_buf,char,script->str_size);
+ memset(script->str_buf + (script->str_size - 256), '\0', 256);
}
- safestrncpy(str_buf+str_pos, p, len+1);
- str_data[str_num].type = C_NOP;
- str_data[str_num].str = str_pos;
- str_data[str_num].next = 0;
- str_data[str_num].func = NULL;
- str_data[str_num].backpatch = -1;
- str_data[str_num].label = -1;
- str_pos += len+1;
+ safestrncpy(script->str_buf+script->str_pos, p, len+1);
+ script->str_data[script->str_num].type = C_NOP;
+ script->str_data[script->str_num].str = script->str_pos;
+ script->str_data[script->str_num].next = 0;
+ script->str_data[script->str_num].func = NULL;
+ script->str_data[script->str_num].backpatch = -1;
+ script->str_data[script->str_num].label = -1;
+ script->str_pos += len+1;
- return str_num++;
+ return script->str_num++;
}
@@ -646,35 +626,35 @@ static void add_scripti(int a)
add_scriptb(a|0x80);
}
-/// Appends a str_data object (label/function/variable/integer) to the script buffer.
+/// Appends a script->str_data object (label/function/variable/integer) to the script buffer.
///
-/// @param l The id of the str_data entry
+/// @param l The id of the script->str_data entry
// Maximum up to 16M
static void add_scriptl(int l)
{
- int backpatch = str_data[l].backpatch;
+ int backpatch = script->str_data[l].backpatch;
- switch(str_data[l].type){
+ switch(script->str_data[l].type){
case C_POS:
case C_USERFUNC_POS:
add_scriptc(C_POS);
- add_scriptb(str_data[l].label);
- add_scriptb(str_data[l].label>>8);
- add_scriptb(str_data[l].label>>16);
+ add_scriptb(script->str_data[l].label);
+ add_scriptb(script->str_data[l].label>>8);
+ add_scriptb(script->str_data[l].label>>16);
break;
case C_NOP:
case C_USERFUNC:
// Embedded data backpatch there is a possibility of label
add_scriptc(C_NAME);
- str_data[l].backpatch = script_pos;
+ script->str_data[l].backpatch = script_pos;
add_scriptb(backpatch);
add_scriptb(backpatch>>8);
add_scriptb(backpatch>>16);
break;
case C_INT:
- add_scripti(abs(str_data[l].val));
- if( str_data[l].val < 0 ) //Notice that this is negative, from jA (Rayce)
+ add_scripti(abs(script->str_data[l].val));
+ if( script->str_data[l].val < 0 ) //Notice that this is negative, from jA (Rayce)
add_scriptc(C_NEG);
break;
default: // assume C_NAME
@@ -693,20 +673,20 @@ void set_label(int l,int pos, const char* script_pos)
{
int i,next;
- if(str_data[l].type==C_INT || str_data[l].type==C_PARAM || str_data[l].type==C_FUNC)
+ if(script->str_data[l].type==C_INT || script->str_data[l].type==C_PARAM || script->str_data[l].type==C_FUNC)
{ //Prevent overwriting constants values, parameters and built-in functions [Skotlex]
disp_error_message("set_label: invalid label name",script_pos);
return;
}
- if(str_data[l].label!=-1){
+ if(script->str_data[l].label!=-1){
disp_error_message("set_label: dup label ",script_pos);
return;
}
- str_data[l].type=(str_data[l].type == C_USERFUNC ? C_USERFUNC_POS : C_POS);
- str_data[l].label=pos;
- for(i=str_data[l].backpatch;i>=0 && i!=0x00ffffff;){
+ script->str_data[l].type=(script->str_data[l].type == C_USERFUNC ? C_USERFUNC_POS : C_POS);
+ script->str_data[l].label=pos;
+ for(i=script->str_data[l].backpatch;i>=0 && i!=0x00ffffff;){
next=GETVALUE(script_buf,i);
- script_buf[i-1]=(str_data[l].type == C_USERFUNC ? C_USERFUNC_POS : C_POS);
+ script_buf[i-1]=(script->str_data[l].type == C_USERFUNC ? C_USERFUNC_POS : C_POS);
SETVALUE(script_buf,i,pos);
i=next;
}
@@ -748,7 +728,7 @@ const char* skip_space(const char* p)
}
/// Skips a word.
-/// A word consists of undercores and/or alfanumeric characters,
+/// A word consists of undercores and/or alphanumeric characters,
/// and valid variable prefixes/postfixes.
static
const char* skip_word(const char* p)
@@ -778,7 +758,7 @@ const char* skip_word(const char* p)
return p;
}
-/// Adds a word to str_data.
+/// Adds a word to script->str_data.
/// @see skip_word
/// @see add_str
static
@@ -791,7 +771,7 @@ int add_word(const char* p)
// Check for a word
len = skip_word(p) - p;
if( len == 0 )
- disp_error_message("script:add_word: invalid word. A word consists of undercores and/or alfanumeric characters, and valid variable prefixes/postfixes.", p);
+ disp_error_message("script:add_word: invalid word. A word consists of undercores and/or alphanumeric characters, and valid variable prefixes/postfixes.", p);
// Duplicate the word
word = (char*)aMalloc(len+1);
@@ -815,21 +795,21 @@ const char* parse_callfunc(const char* p, int require_paren, int is_custom)
int func;
func = add_word(p);
- if( str_data[func].type == C_FUNC ){
+ if( script->str_data[func].type == C_FUNC ){
char argT = 0;
// buildin function
add_scriptl(func);
add_scriptc(C_ARG);
- arg = script->buildin[str_data[func].val];
+ arg = script->buildin[script->str_data[func].val];
if( !arg ) arg = &argT;
- } else if( str_data[func].type == C_USERFUNC || str_data[func].type == C_USERFUNC_POS ){
+ } else if( script->str_data[func].type == C_USERFUNC || script->str_data[func].type == C_USERFUNC_POS ){
// script defined function
add_scriptl(buildin_callsub_ref);
add_scriptc(C_ARG);
add_scriptl(func);
- arg = script->buildin[str_data[buildin_callsub_ref].val];
+ arg = script->buildin[script->str_data[buildin_callsub_ref].val];
if( *arg == 0 )
- disp_error_message("parse_callfunc: callsub has no arguments, please review it's definition",p);
+ disp_error_message("parse_callfunc: callsub has no arguments, please review its definition",p);
if( *arg != '*' )
++arg; // count func as argument
} else {
@@ -845,7 +825,7 @@ const char* parse_callfunc(const char* p, int require_paren, int is_custom)
add_scriptc(C_STR);
while( *name ) add_scriptb(*name ++);
add_scriptb(0);
- arg = script->buildin[str_data[buildin_callfunc_ref].val];
+ arg = script->buildin[script->str_data[buildin_callfunc_ref].val];
if( *arg != '*' ) ++ arg;
}
#endif
@@ -918,9 +898,9 @@ static void parse_nextline(bool first, const char* p)
}
// initialize data for new '-' label fix up scheduling
- str_data[LABEL_NEXTLINE].type = C_NOP;
- str_data[LABEL_NEXTLINE].backpatch = -1;
- str_data[LABEL_NEXTLINE].label = -1;
+ script->str_data[LABEL_NEXTLINE].type = C_NOP;
+ script->str_data[LABEL_NEXTLINE].backpatch = -1;
+ script->str_data[LABEL_NEXTLINE].label = -1;
}
/// Parse a variable assignment using the direct equals operator
@@ -1007,7 +987,7 @@ const char* parse_variable(const char* p) {
// parse the variable currently being modified
word = add_word(var);
- if( str_data[word].type == C_FUNC || str_data[word].type == C_USERFUNC || str_data[word].type == C_USERFUNC_POS )
+ if( script->str_data[word].type == C_FUNC || script->str_data[word].type == C_USERFUNC || script->str_data[word].type == C_USERFUNC_POS )
{// cannot assign a variable which exists as a function or label
disp_error_message("Cannot modify a variable which has the same name as a function or label.", p);
}
@@ -1069,7 +1049,7 @@ const char* parse_simpleexpr(const char *p)
p=skip_space(p);
if(*p==';' || *p==',')
- disp_error_message("parse_simpleexpr: unexpected expr end",p);
+ disp_error_message("parse_simpleexpr: unexpected end of expression",p);
if(*p=='('){
if( (i=syntax.curly_count-1) >= 0 && syntax.curly[i].type == TYPE_ARGLIST )
++syntax.curly[i].count;
@@ -1085,7 +1065,7 @@ const char* parse_simpleexpr(const char *p)
syntax.curly[i].flag = ARGLIST_NO_PAREN;
}
if( *p != ')' )
- disp_error_message("parse_simpleexpr: unmatch ')'",p);
+ disp_error_message("parse_simpleexpr: unmatched ')'",p);
++p;
} else if(ISDIGIT(*p) || ((*p=='-' || *p=='+') && ISDIGIT(p[1]))){
char *np;
@@ -1111,7 +1091,7 @@ const char* parse_simpleexpr(const char *p)
add_scriptb(*p++);
}
if(!*p)
- disp_error_message("parse_simpleexpr: unexpected eof @ string",p);
+ disp_error_message("parse_simpleexpr: unexpected end of file @ string",p);
add_scriptb(0);
p++; //'"'
} else {
@@ -1123,7 +1103,7 @@ const char* parse_simpleexpr(const char *p)
disp_error_message("parse_simpleexpr: unexpected character",p);
l=add_word(p);
- if( str_data[l].type == C_FUNC || str_data[l].type == C_USERFUNC || str_data[l].type == C_USERFUNC_POS)
+ if( script->str_data[l].type == C_FUNC || script->str_data[l].type == C_USERFUNC || script->str_data[l].type == C_USERFUNC_POS)
return parse_callfunc(p,1,0);
#ifdef SCRIPT_CALLFUNC_CHECK
else {
@@ -1149,7 +1129,7 @@ const char* parse_simpleexpr(const char *p)
p=parse_subexpr(p+1,-1);
p=skip_space(p);
if( *p != ']' )
- disp_error_message("parse_simpleexpr: unmatch ']'",p);
+ disp_error_message("parse_simpleexpr: unmatched ']'",p);
++p;
add_scriptc(C_FUNC);
}else
@@ -1350,8 +1330,8 @@ const char* parse_curly_close(const char* p)
}
// Syntax-related processing
-// break, case, continue, default, do, for, function,
-// if, switch, while ? will handle this internally.
+// break, case, continue, default, do, for, function,
+// if, switch, while ? will handle this internally.
const char* parse_syntax(const char* p)
{
const char *p2 = skip_word(p);
@@ -1431,14 +1411,14 @@ const char* parse_syntax(const char* p)
memcpy(label,p,v);
label[v]='\0';
if( !script_get_constant(label, &v) )
- disp_error_message("parse_syntax: 'case' label not integer",p);
+ disp_error_message("parse_syntax: 'case' label is not an integer",p);
p = skip_word(p);
} else { //Numeric value
if((*p == '-' || *p == '+') && ISDIGIT(p[1])) // pre-skip because '-' can not skip_word
p++;
p = skip_word(p);
if(np != p)
- disp_error_message("parse_syntax: 'case' label not integer",np);
+ disp_error_message("parse_syntax: 'case' label is not an integer",np);
}
p = skip_space(p);
if(*p != ':')
@@ -1646,9 +1626,9 @@ const char* parse_syntax(const char* p)
// function declaration - just register the name
int l;
l = add_word(func_name);
- if( str_data[l].type == C_NOP )// register only, if the name was not used by something else
- str_data[l].type = C_USERFUNC;
- else if( str_data[l].type == C_USERFUNC )
+ if( script->str_data[l].type == C_NOP )// register only, if the name was not used by something else
+ script->str_data[l].type = C_USERFUNC;
+ else if( script->str_data[l].type == C_USERFUNC )
; // already registered
else
disp_error_message("parse_syntax:function: function name is invalid", func_name);
@@ -1677,9 +1657,9 @@ const char* parse_syntax(const char* p)
// Set the position of the function (label)
l=add_word(func_name);
- if( str_data[l].type == C_NOP || str_data[l].type == C_USERFUNC )// register only, if the name was not used by something else
+ if( script->str_data[l].type == C_NOP || script->str_data[l].type == C_USERFUNC )// register only, if the name was not used by something else
{
- str_data[l].type = C_USERFUNC;
+ script->str_data[l].type = C_USERFUNC;
set_label(l, script_pos, p);
if( parse_options&SCRIPT_USE_LABEL_DB )
strdb_iput(scriptlabel_db, get_str(l), script_pos);
@@ -1974,11 +1954,11 @@ bool script_get_constant(const char* name, int* value)
{
int n = search_str(name);
- if( n == -1 || str_data[n].type != C_INT )
+ if( n == -1 || script->str_data[n].type != C_INT )
{// not found or not a constant
return false;
}
- value[0] = str_data[n].val;
+ value[0] = script->str_data[n].val;
return true;
}
@@ -1988,18 +1968,18 @@ void script_set_constant(const char* name, int value, bool isparameter)
{
int n = add_str(name);
- if( str_data[n].type == C_NOP )
+ if( script->str_data[n].type == C_NOP )
{// new
- str_data[n].type = isparameter ? C_PARAM : C_INT;
- str_data[n].val = value;
+ script->str_data[n].type = isparameter ? C_PARAM : C_INT;
+ script->str_data[n].val = value;
}
- else if( str_data[n].type == C_PARAM || str_data[n].type == C_INT )
+ else if( script->str_data[n].type == C_PARAM || script->str_data[n].type == C_INT )
{// existing parameter or constant
- ShowError("script_set_constant: Attempted to overwrite existing %s '%s' (old value=%d, new value=%d).\n", ( str_data[n].type == C_PARAM ) ? "parameter" : "constant", name, str_data[n].val, value);
+ ShowError("script_set_constant: Attempted to overwrite existing %s '%s' (old value=%d, new value=%d).\n", ( script->str_data[n].type == C_PARAM ) ? "parameter" : "constant", name, script->str_data[n].val, value);
}
else
{// existing name
- ShowError("script_set_constant: Invalid name for %s '%s' (already defined as %s).\n", isparameter ? "parameter" : "constant", name, script_op2name(str_data[n].type));
+ ShowError("script_set_constant: Invalid name for %s '%s' (already defined as %s).\n", isparameter ? "parameter" : "constant", name, script_op2name(script->str_data[n].type));
}
}
@@ -2126,8 +2106,8 @@ struct script_code* parse_script(const char *src,const char *file,int line,int o
script_pos = 0;
script_size = 0;
script_buf = NULL;
- for(i=LABEL_START;i<str_num;i++)
- if(str_data[i].type == C_NOP) str_data[i].type = C_NAME;
+ for(i=LABEL_START;i<script->str_num;i++)
+ if(script->str_data[i].type == C_NOP) script->str_data[i].type = C_NAME;
for(i=0; i<size; i++)
linkdb_final(&syntax.curly[i].case_label);
return NULL;
@@ -2165,14 +2145,14 @@ struct script_code* parse_script(const char *src,const char *file,int line,int o
}
// clear references of labels, variables and internal functions
- for(i=LABEL_START;i<str_num;i++){
+ for(i=LABEL_START;i<script->str_num;i++){
if(
- str_data[i].type==C_POS || str_data[i].type==C_NAME ||
- str_data[i].type==C_USERFUNC || str_data[i].type == C_USERFUNC_POS
+ script->str_data[i].type==C_POS || script->str_data[i].type==C_NAME ||
+ script->str_data[i].type==C_USERFUNC || script->str_data[i].type == C_USERFUNC_POS
){
- str_data[i].type=C_NOP;
- str_data[i].backpatch=-1;
- str_data[i].label=-1;
+ script->str_data[i].type=C_NOP;
+ script->str_data[i].backpatch=-1;
+ script->str_data[i].label=-1;
}
}
@@ -2206,20 +2186,20 @@ struct script_code* parse_script(const char *src,const char *file,int line,int o
RECREATE(script_buf,unsigned char,script_pos);
// default unknown references to variables
- for(i=LABEL_START;i<str_num;i++){
- if(str_data[i].type==C_NOP){
+ for(i=LABEL_START;i<script->str_num;i++){
+ if(script->str_data[i].type==C_NOP){
int j,next;
- str_data[i].type=C_NAME;
- str_data[i].label=i;
- for(j=str_data[i].backpatch;j>=0 && j!=0x00ffffff;){
+ script->str_data[i].type=C_NAME;
+ script->str_data[i].label=i;
+ for(j=script->str_data[i].backpatch;j>=0 && j!=0x00ffffff;){
next=GETVALUE(script_buf,j);
SETVALUE(script_buf,j,i);
j=next;
}
}
- else if( str_data[i].type == C_USERFUNC )
+ else if( script->str_data[i].type == C_USERFUNC )
{// 'function name;' without follow-up code
- ShowError("parse_script: function '%s' declared but not defined.\n", str_buf+str_data[i].str);
+ ShowError("parse_script: function '%s' declared but not defined.\n", script->str_buf+script->str_data[i].str);
unresolved_names = true;
}
}
@@ -2315,13 +2295,13 @@ void get_val(struct script_state* st, struct script_data* data)
{// needs player attached
if( postfix == '$' )
{// string variable
- ShowWarning("script:get_val: cannot access player variable '%s', defaulting to \"\"\n", name);
+ ShowWarning("script:script->get_val: cannot access player variable '%s', defaulting to \"\"\n", name);
data->type = C_CONSTSTR;
data->u.str = "";
}
else
{// integer variable
- ShowWarning("script:get_val: cannot access player variable '%s', defaulting to 0\n", name);
+ ShowWarning("script:script->get_val: cannot access player variable '%s', defaulting to 0\n", name);
data->type = C_INT;
data->u.num = 0;
}
@@ -2335,7 +2315,7 @@ void get_val(struct script_state* st, struct script_data* data)
switch( prefix )
{
case '@':
- data->u.str = iPc->readregstr(sd, data->u.num);
+ data->u.str = pc->readregstr(sd, data->u.num);
break;
case '$':
data->u.str = mapreg_readregstr(data->u.num);
@@ -2362,7 +2342,7 @@ void get_val(struct script_state* st, struct script_data* data)
if ( st->instance_id >= 0 ) {
data->u.str = (char*)idb_get(instances[st->instance_id].vars,reference_getuid(data));
} else {
- ShowWarning("script:get_val: cannot access instance variable '%s', defaulting to \"\"\n", name);
+ ShowWarning("script:script->get_val: cannot access instance variable '%s', defaulting to \"\"\n", name);
data->u.str = NULL;
}
break;
@@ -2394,13 +2374,13 @@ void get_val(struct script_state* st, struct script_data* data)
}
else if( reference_toparam(data) )
{
- data->u.num = iPc->readparam(sd, reference_getparamtype(data));
+ data->u.num = pc->readparam(sd, reference_getparamtype(data));
}
else
switch( prefix )
{
case '@':
- data->u.num = iPc->readreg(sd, data->u.num);
+ data->u.num = pc->readreg(sd, data->u.num);
break;
case '$':
data->u.num = mapreg_readreg(data->u.num);
@@ -2427,7 +2407,7 @@ void get_val(struct script_state* st, struct script_data* data)
if( st->instance_id >= 0 )
data->u.num = (int)idb_iget(instances[st->instance_id].vars,reference_getuid(data));
else {
- ShowWarning("script:get_val: cannot access instance variable '%s', defaulting to 0\n", name);
+ ShowWarning("script:script->get_val: cannot access instance variable '%s', defaulting to 0\n", name);
data->u.num = 0;
}
break;
@@ -2441,16 +2421,13 @@ void get_val(struct script_state* st, struct script_data* data)
return;
}
-struct script_data* push_val2(struct script_stack* stack, enum c_op type, int val, struct DBMap** ref);
-
/// Retrieves the value of a reference identified by uid (variable, constant, param)
/// The value is left in the top of the stack and needs to be removed manually.
-void* get_val2(struct script_state* st, int uid, struct DBMap** ref)
-{
+void* get_val2(struct script_state* st, int uid, struct DBMap** ref) {
struct script_data* data;
- push_val2(st->stack, C_NAME, uid, ref);
+ script->push_val(st->stack, C_NAME, uid, ref);
data = script_getdatatop(st, -1);
- get_val(st, data);
+ script->get_val(st, data);
return (data->type == C_INT ? (void*)__64BPTRSIZE(data->u.num) : (void*)__64BPTRSIZE(data->u.str));
}
@@ -2467,7 +2444,7 @@ static int set_reg(struct script_state* st, TBL_PC* sd, int num, const char* nam
const char* str = (const char*)value;
switch (prefix) {
case '@':
- return iPc->setregstr(sd, num, str);
+ return pc->setregstr(sd, num, str);
case '$':
return mapreg_setregstr(num, str);
case '#':
@@ -2497,9 +2474,9 @@ static int set_reg(struct script_state* st, TBL_PC* sd, int num, const char* nam
else
{// integer variable
int val = (int)__64BPTRSIZE(value);
- if(str_data[num&0x00ffffff].type == C_PARAM)
+ if(script->str_data[num&0x00ffffff].type == C_PARAM)
{
- if( iPc->setparam(sd, str_data[num&0x00ffffff].val, val) == 0 )
+ if( pc->setparam(sd, script->str_data[num&0x00ffffff].val, val) == 0 )
{
if( st != NULL )
{
@@ -2514,7 +2491,7 @@ static int set_reg(struct script_state* st, TBL_PC* sd, int num, const char* nam
switch (prefix) {
case '@':
- return iPc->setreg(sd, num, val);
+ return pc->setreg(sd, num, val);
case '$':
return mapreg_setreg(num, val);
case '#':
@@ -2560,7 +2537,7 @@ const char* conv_str(struct script_state* st, struct script_data* data)
{
char* p;
- get_val(st, data);
+ script->get_val(st, data);
if( data_isstring(data) )
{// nothing to convert
}
@@ -2574,7 +2551,7 @@ const char* conv_str(struct script_state* st, struct script_data* data)
}
else if( data_isreference(data) )
{// reference -> string
- //##TODO when does this happen (check get_val) [FlavioJS]
+ //##TODO when does this happen (check script->get_val) [FlavioJS]
data->type = C_CONSTSTR;
data->u.str = reference_getname(data);
}
@@ -2594,7 +2571,7 @@ int conv_num(struct script_state* st, struct script_data* data) {
char* p;
long num;
- get_val(st, data);
+ script->get_val(st, data);
if( data_isint(data) )
{// nothing to convert
}
@@ -2649,8 +2626,7 @@ int conv_num(struct script_state* st, struct script_data* data) {
//
/// Increases the size of the stack
-void stack_expand(struct script_stack* stack)
-{
+void stack_expand(struct script_stack* stack) {
stack->sp_max += 64;
stack->stack_data = (struct script_data*)aRealloc(stack->stack_data,
stack->sp_max * sizeof(stack->stack_data[0]) );
@@ -2658,12 +2634,8 @@ void stack_expand(struct script_stack* stack)
64 * sizeof(stack->stack_data[0]) );
}
-/// Pushes a value into the stack
-#define push_val(stack,type,val) push_val2(stack, type, val, NULL)
-
/// Pushes a value into the stack (with reference)
-struct script_data* push_val2(struct script_stack* stack, enum c_op type, int val, struct DBMap** ref)
-{
+struct script_data* push_val(struct script_stack* stack, enum c_op type, int val, struct DBMap** ref) {
if( stack->sp >= stack->sp_max )
stack_expand(stack);
stack->stack_data[stack->sp].type = type;
@@ -2698,28 +2670,26 @@ struct script_data* push_retinfo(struct script_stack* stack, struct script_retin
}
/// Pushes a copy of the target position into the stack
-struct script_data* push_copy(struct script_stack* stack, int pos)
-{
- switch( stack->stack_data[pos].type )
- {
- case C_CONSTSTR:
- return push_str(stack, C_CONSTSTR, stack->stack_data[pos].u.str);
- break;
- case C_STR:
- return push_str(stack, C_STR, aStrdup(stack->stack_data[pos].u.str));
- break;
- case C_RETINFO:
- ShowFatalError("script:push_copy: can't create copies of C_RETINFO. Exiting...\n");
- exit(1);
- break;
- default:
- return push_val2(
- stack,stack->stack_data[pos].type,
- stack->stack_data[pos].u.num,
- stack->stack_data[pos].ref
- );
- break;
- }
+struct script_data* push_copy(struct script_stack* stack, int pos) {
+ switch( stack->stack_data[pos].type ) {
+ case C_CONSTSTR:
+ return script->push_str(stack, C_CONSTSTR, stack->stack_data[pos].u.str);
+ break;
+ case C_STR:
+ return script->push_str(stack, C_STR, aStrdup(stack->stack_data[pos].u.str));
+ break;
+ case C_RETINFO:
+ ShowFatalError("script:push_copy: can't create copies of C_RETINFO. Exiting...\n");
+ exit(1);
+ break;
+ default:
+ return script->push_val(
+ stack,stack->stack_data[pos].type,
+ stack->stack_data[pos].u.num,
+ stack->stack_data[pos].ref
+ );
+ break;
+ }
}
/// Removes the values in indexes [start,end[ from the stack.
@@ -2833,7 +2803,7 @@ void script_free_state(struct script_state* st)
if( st->sleep.timer != INVALID_TIMER )
iTimer->delete_timer(st->sleep.timer, run_script_timer);
script_free_vars(st->stack->var_function);
- pop_stack(st, 0, st->stack->sp);
+ script->pop_stack(st, 0, st->stack->sp);
aFree(st->stack->stack_data);
aFree(st->stack);
st->stack = NULL;
@@ -2883,7 +2853,7 @@ int pop_val(struct script_state* st)
if(st->stack->sp<=0)
return 0;
st->stack->sp--;
- get_val(st,&(st->stack->stack_data[st->stack->sp]));
+ script->get_val(st,&(st->stack->stack_data[st->stack->sp]));
if(st->stack->stack_data[st->stack->sp].type==C_INT)
return st->stack->stack_data[st->stack->sp].u.num;
return 0;
@@ -2897,7 +2867,7 @@ void op_3(struct script_state* st, int op)
int flag = 0;
data = script_getdatatop(st, -3);
- get_val(st, data);
+ script->get_val(st, data);
if( data_isstring(data) )
flag = data->u.str[0];// "" -> false
@@ -3041,8 +3011,8 @@ void op_2(struct script_state *st, int op)
st->op2ref = 0;
}
- get_val(st, left);
- get_val(st, right);
+ script->get_val(st, left);
+ script->get_val(st, right);
// automatic conversions
switch( op )
@@ -3103,7 +3073,7 @@ void op_1(struct script_state* st, int op)
int i1;
data = script_getdatatop(st, -1);
- get_val(st, data);
+ script->get_val(st, data);
if( !data_isint(data) )
{// not a number
@@ -3141,7 +3111,7 @@ static void script_check_buildin_argtype(struct script_state* st, int func)
{
char type;
int idx, invalid = 0;
- char* sf = script->buildin[str_data[func].val];
+ char* sf = script->buildin[script->str_data[func].val];
for( idx = 2; script_hasdata(st, idx); idx++ ) {
struct script_data* data = script_getdata(st, idx);
@@ -3237,7 +3207,7 @@ int run_func(struct script_state *st)
st->end = end_sp;
data = &st->stack->stack_data[st->start];
- if( data->type == C_NAME && str_data[data->u.num].type == C_FUNC )
+ if( data->type == C_NAME && script->str_data[data->u.num].type == C_FUNC )
func = data->u.num;
else
{
@@ -3253,11 +3223,11 @@ int run_func(struct script_state *st)
script_check_buildin_argtype(st, func);
}
- if(str_data[func].func){
- if (!(str_data[func].func(st))) //Report error
+ if(script->str_data[func].func){
+ if (!(script->str_data[func].func(st))) //Report error
script_reportsrc(st);
} else {
- ShowError("script:run_func: '%s' (id=%d type=%s) has no C function. please report this!!!\n", get_str(func), func, script_op2name(str_data[func].type));
+ ShowError("script:run_func: '%s' (id=%d type=%s) has no C function. please report this!!!\n", get_str(func), func, script_op2name(script->str_data[func].type));
script_reportsrc(st);
st->state = END;
}
@@ -3266,14 +3236,14 @@ int run_func(struct script_state *st)
if( st->state == RERUNLINE )
return 0;
- pop_stack(st, st->start, st->end);
+ script->pop_stack(st, st->start, st->end);
if( st->state == RETFUNC )
{// return from a user-defined function
struct script_retinfo* ri;
int olddefsp = st->stack->defsp;
int nargs;
- pop_stack(st, st->stack->defsp, st->start);// pop distractions from the stack
+ script->pop_stack(st, st->stack->defsp, st->start);// pop distractions from the stack
if( st->stack->defsp < 1 || st->stack->stack_data[st->stack->defsp-1].type != C_RETINFO )
{
ShowWarning("script:run_func: return without callfunc or callsub!\n");
@@ -3291,7 +3261,7 @@ int run_func(struct script_state *st)
st->stack->defsp = ri->defsp;
memset(ri, 0, sizeof(struct script_retinfo));
- pop_stack(st, olddefsp-nargs-1, olddefsp);// pop arguments and retinfo
+ script->pop_stack(st, olddefsp-nargs-1, olddefsp);// pop arguments and retinfo
st->state = GOTO;
}
@@ -3482,21 +3452,21 @@ void run_script_main(struct script_state *st)
if( stack->defsp > stack->sp )
ShowError("script:run_script_main: unexpected stack position (defsp=%d sp=%d). please report this!!!\n", stack->defsp, stack->sp);
else
- pop_stack(st, stack->defsp, stack->sp);// pop unused stack data. (unused return value)
+ script->pop_stack(st, stack->defsp, stack->sp);// pop unused stack data. (unused return value)
break;
case C_INT:
- push_val(stack,C_INT,get_num(st->script->script_buf,&st->pos));
+ script->push_val(stack,C_INT,get_num(st->script->script_buf,&st->pos),NULL);
break;
case C_POS:
case C_NAME:
- push_val(stack,c,GETVALUE(st->script->script_buf,st->pos));
+ script->push_val(stack,c,GETVALUE(st->script->script_buf,st->pos),NULL);
st->pos+=3;
break;
case C_ARG:
- push_val(stack,c,0);
+ script->push_val(stack,c,0,NULL);
break;
case C_STR:
- push_str(stack,C_CONSTSTR,(char*)(st->script->script_buf+st->pos));
+ script->push_str(stack,C_CONSTSTR,(char*)(st->script->script_buf+st->pos));
while(st->script->script_buf[st->pos++]);
break;
case C_FUNC:
@@ -3659,7 +3629,7 @@ int script_config_read(char *cfgName)
*/
static int db_script_free_code_sub(DBKey key, DBData *data, va_list ap)
{
- struct script_code *code = iDB->data2ptr(data);
+ struct script_code *code = DB->data2ptr(data);
if (code)
script_free_code(code);
return 0;
@@ -3706,14 +3676,14 @@ void script_cleararray_pc(struct map_session_data* sd, const char* varname, void
{
for( idx = 0; idx < SCRIPT_MAX_ARRAYSIZE; idx++ )
{
- iPc->setregstr(sd, reference_uid(key, idx), (const char*)value);
+ pc->setregstr(sd, reference_uid(key, idx), (const char*)value);
}
}
else
{
for( idx = 0; idx < SCRIPT_MAX_ARRAYSIZE; idx++ )
{
- iPc->setreg(sd, reference_uid(key, idx), (int)__64BPTRSIZE(value));
+ pc->setreg(sd, reference_uid(key, idx), (int)__64BPTRSIZE(value));
}
}
}
@@ -3741,11 +3711,11 @@ void script_setarray_pc(struct map_session_data* sd, const char* varname, uint8
if( is_string_variable(varname) )
{
- iPc->setregstr(sd, reference_uid(key, idx), (const char*)value);
+ pc->setregstr(sd, reference_uid(key, idx), (const char*)value);
}
else
{
- iPc->setreg(sd, reference_uid(key, idx), (int)__64BPTRSIZE(value));
+ pc->setreg(sd, reference_uid(key, idx), (int)__64BPTRSIZE(value));
}
if( refcache )
@@ -3774,7 +3744,7 @@ void do_final_script(void) {
memset(count, 0, sizeof(count));
fprintf(fp,"num : hash : data_name\n");
fprintf(fp,"---------------------------------------------------------------\n");
- for(i=LABEL_START; i<str_num; i++) {
+ for(i=LABEL_START; i<script->str_num; i++) {
unsigned int h = calc_hash(get_str(i));
fprintf(fp,"%04d : %4u : %s\n",i,h, get_str(i));
++count[h];
@@ -3828,10 +3798,10 @@ void do_final_script(void) {
linkdb_final(&sleep_db);
}
- if (str_data)
- aFree(str_data);
- if (str_buf)
- aFree(str_buf);
+ if (script->str_data)
+ aFree(script->str_data);
+ if (script->str_buf)
+ aFree(script->str_buf);
for( i = 0; i < atcommand->binding_count; i++ ) {
aFree(atcommand->binding[i]);
@@ -4159,7 +4129,7 @@ BUILDIN(menu)
st->state = END;
return false;
}
- iPc->setreg(sd, add_str("@menu"), menu);
+ pc->setreg(sd, add_str("@menu"), menu);
st->pos = script_getnum(st, i + 1);
st->state = GOTO;
}
@@ -4236,7 +4206,7 @@ BUILDIN(select)
if( sd->npc_menu <= 0 )
break;// entry found
}
- iPc->setreg(sd, add_str("@menu"), menu);
+ pc->setreg(sd, add_str("@menu"), menu);
script_pushint(st, menu);
st->state = RUN;
}
@@ -4307,7 +4277,7 @@ BUILDIN(prompt)
else if( sd->npc_menu == 0xff )
{// Cancel was pressed
sd->state.menu_or_input = 0;
- iPc->setreg(sd, add_str("@menu"), 0xff);
+ pc->setreg(sd, add_str("@menu"), 0xff);
script_pushint(st, 0xff);
st->state = RUN;
}
@@ -4323,7 +4293,7 @@ BUILDIN(prompt)
if( sd->npc_menu <= 0 )
break;// entry found
}
- iPc->setreg(sd, add_str("@menu"), menu);
+ pc->setreg(sd, add_str("@menu"), menu);
script_pushint(st, menu);
st->state = RUN;
}
@@ -4373,7 +4343,7 @@ BUILDIN(callfunc)
for( i = st->start+3, j = 0; i < st->end; i++, j++ )
{
- struct script_data* data = push_copy(st->stack,i);
+ struct script_data* data = script->push_copy(st->stack,i);
if( data_isreference(data) && !data->ref )
{
const char* name = reference_getname(data);
@@ -4421,7 +4391,7 @@ BUILDIN(callsub)
for( i = st->start+3, j = 0; i < st->end; i++, j++ )
{
- struct script_data* data = push_copy(st->stack,i);
+ struct script_data* data = script->push_copy(st->stack,i);
if( data_isreference(data) && !data->ref )
{
const char* name = reference_getname(data);
@@ -4471,7 +4441,7 @@ BUILDIN(getarg)
idx = script_getnum(st,2);
if( idx >= 0 && idx < ri->nargs )
- push_copy(st->stack, st->stack->defsp - 1 - ri->nargs + idx);
+ script->push_copy(st->stack, st->stack->defsp - 1 - ri->nargs + idx);
else if( script_hasdata(st,3) )
script_pushcopy(st, 3);
else
@@ -4502,7 +4472,7 @@ BUILDIN(return)
if( name[0] == '.' && name[1] == '@' )
{// scope variable
if( !data->ref || data->ref == (DBMap**)&st->stack->var_function )
- get_val(st, data);// current scope, convert to value
+ script->get_val(st, data);// current scope, convert to value
}
else if( name[0] == '.' && !data->ref )
{// script variable, link to current script
@@ -4569,11 +4539,11 @@ BUILDIN(warp)
y = script_getnum(st,4);
if(strcmp(str,"Random")==0)
- ret = iPc->randomwarp(sd,CLR_TELEPORT);
+ ret = pc->randomwarp(sd,CLR_TELEPORT);
else if(strcmp(str,"SavePoint")==0 || strcmp(str,"Save")==0)
- ret = iPc->setpos(sd,sd->status.save_point.map,sd->status.save_point.x,sd->status.save_point.y,CLR_TELEPORT);
+ ret = pc->setpos(sd,sd->status.save_point.map,sd->status.save_point.x,sd->status.save_point.y,CLR_TELEPORT);
else
- ret = iPc->setpos(sd,mapindex_name2id(str),x,y,CLR_OUTSIGHT);
+ ret = pc->setpos(sd,mapindex_name2id(str),x,y,CLR_OUTSIGHT);
if( ret ) {
ShowError("buildin_warp: moving player '%s' to \"%s\",%d,%d failed.\n", sd->status.name, str, x, y);
@@ -4597,7 +4567,7 @@ static int buildin_areawarp_sub(struct block_list *bl,va_list ap)
y3 = va_arg(ap,int);
if(index == 0)
- iPc->randomwarp((TBL_PC *)bl,CLR_TELEPORT);
+ pc->randomwarp((TBL_PC *)bl,CLR_TELEPORT);
else if(x3 && y3) {
int max, tx, ty, j = 0;
@@ -4612,10 +4582,10 @@ static int buildin_areawarp_sub(struct block_list *bl,va_list ap)
j++;
} while( iMap->getcell(index,tx,ty,CELL_CHKNOPASS) && j < max );
- iPc->setpos((TBL_PC *)bl,index,tx,ty,CLR_OUTSIGHT);
+ pc->setpos((TBL_PC *)bl,index,tx,ty,CLR_OUTSIGHT);
}
else
- iPc->setpos((TBL_PC *)bl,index,x2,y2,CLR_OUTSIGHT);
+ pc->setpos((TBL_PC *)bl,index,x2,y2,CLR_OUTSIGHT);
return 0;
}
BUILDIN(areawarp)
@@ -4665,7 +4635,7 @@ static int buildin_areapercentheal_sub(struct block_list *bl,va_list ap)
int hp, sp;
hp = va_arg(ap, int);
sp = va_arg(ap, int);
- iPc->percentheal((TBL_PC *)bl,hp,sp);
+ pc->percentheal((TBL_PC *)bl,hp,sp);
return 0;
}
BUILDIN(areapercentheal)
@@ -4711,12 +4681,12 @@ BUILDIN(warpchar)
return true;
if(strcmp(str, "Random") == 0)
- iPc->randomwarp(sd, CLR_TELEPORT);
+ pc->randomwarp(sd, CLR_TELEPORT);
else
if(strcmp(str, "SavePoint") == 0)
- iPc->setpos(sd, sd->status.save_point.map,sd->status.save_point.x, sd->status.save_point.y, CLR_TELEPORT);
+ pc->setpos(sd, sd->status.save_point.map,sd->status.save_point.x, sd->status.save_point.y, CLR_TELEPORT);
else
- iPc->setpos(sd, mapindex_name2id(str), x, y, CLR_TELEPORT);
+ pc->setpos(sd, mapindex_name2id(str), x, y, CLR_TELEPORT);
return true;
}
@@ -4742,7 +4712,7 @@ BUILDIN(warpparty)
if ( script_hasdata(st,6) )
str2 = script_getstr(st,6);
- p = iParty->search(p_id);
+ p = party->search(p_id);
if(!p)
return true;
@@ -4790,20 +4760,20 @@ BUILDIN(warpparty)
{
case 0: // Random
if(!map[pl_sd->bl.m].flag.nowarp)
- iPc->randomwarp(pl_sd,CLR_TELEPORT);
+ pc->randomwarp(pl_sd,CLR_TELEPORT);
break;
case 1: // SavePointAll
if(!map[pl_sd->bl.m].flag.noreturn)
- iPc->setpos(pl_sd,pl_sd->status.save_point.map,pl_sd->status.save_point.x,pl_sd->status.save_point.y,CLR_TELEPORT);
+ pc->setpos(pl_sd,pl_sd->status.save_point.map,pl_sd->status.save_point.x,pl_sd->status.save_point.y,CLR_TELEPORT);
break;
case 2: // SavePoint
if(!map[pl_sd->bl.m].flag.noreturn)
- iPc->setpos(pl_sd,sd->status.save_point.map,sd->status.save_point.x,sd->status.save_point.y,CLR_TELEPORT);
+ pc->setpos(pl_sd,sd->status.save_point.map,sd->status.save_point.x,sd->status.save_point.y,CLR_TELEPORT);
break;
case 3: // Leader
case 4: // m,x,y
if(!map[pl_sd->bl.m].flag.noreturn && !map[pl_sd->bl.m].flag.nowarp)
- iPc->setpos(pl_sd,mapindex,x,y,CLR_TELEPORT);
+ pc->setpos(pl_sd,mapindex,x,y,CLR_TELEPORT);
break;
}
}
@@ -4851,19 +4821,19 @@ BUILDIN(warpguild)
{
case 0: // Random
if(!map[pl_sd->bl.m].flag.nowarp)
- iPc->randomwarp(pl_sd,CLR_TELEPORT);
+ pc->randomwarp(pl_sd,CLR_TELEPORT);
break;
case 1: // SavePointAll
if(!map[pl_sd->bl.m].flag.noreturn)
- iPc->setpos(pl_sd,pl_sd->status.save_point.map,pl_sd->status.save_point.x,pl_sd->status.save_point.y,CLR_TELEPORT);
+ pc->setpos(pl_sd,pl_sd->status.save_point.map,pl_sd->status.save_point.x,pl_sd->status.save_point.y,CLR_TELEPORT);
break;
case 2: // SavePoint
if(!map[pl_sd->bl.m].flag.noreturn)
- iPc->setpos(pl_sd,sd->status.save_point.map,sd->status.save_point.x,sd->status.save_point.y,CLR_TELEPORT);
+ pc->setpos(pl_sd,sd->status.save_point.map,sd->status.save_point.x,sd->status.save_point.y,CLR_TELEPORT);
break;
case 3: // m,x,y
if(!map[pl_sd->bl.m].flag.noreturn && !map[pl_sd->bl.m].flag.nowarp)
- iPc->setpos(pl_sd,mapindex_name2id(str),x,y,CLR_TELEPORT);
+ pc->setpos(pl_sd,mapindex_name2id(str),x,y,CLR_TELEPORT);
break;
}
}
@@ -4906,7 +4876,7 @@ BUILDIN(itemheal)
sd = script_rid2sd(st);
if (!sd) return true;
- iPc->itemheal(sd,sd->itemid,hp,sp);
+ pc->itemheal(sd,sd->itemid,hp,sp);
return true;
}
/*==========================================
@@ -4933,7 +4903,7 @@ BUILDIN(percentheal)
if( sd->sc.data[SC_EXTREMITYFIST2] )
sp = 0;
#endif
- iPc->percentheal(sd,hp,sp);
+ pc->percentheal(sd,hp,sp);
return true;
}
@@ -4956,7 +4926,7 @@ BUILDIN(jobchange)
if( sd == NULL )
return true;
- iPc->jobchange(sd, job, upper);
+ pc->jobchange(sd, job, upper);
}
return true;
@@ -4968,7 +4938,7 @@ BUILDIN(jobchange)
BUILDIN(jobname)
{
int class_=script_getnum(st,2);
- script_pushconststr(st, (char*)iPc->job_name(class_));
+ script_pushconststr(st, (char*)pc->job_name(class_));
return true;
}
@@ -5097,7 +5067,7 @@ BUILDIN(set)
}
// push the maximum number of array values to the stack
- push_val(st->stack, C_INT, SCRIPT_MAX_ARRAYSIZE);
+ script->push_val(st->stack, C_INT, SCRIPT_MAX_ARRAYSIZE,NULL);
// call the copy array method directly
return buildin_copyarray(st);
@@ -5129,7 +5099,7 @@ static int32 getarraysize(struct script_state* st, int32 id, int32 idx, int isst
{
for( ; idx < SCRIPT_MAX_ARRAYSIZE; ++idx )
{
- char* str = (char*)get_val2(st, reference_uid(id, idx), ref);
+ char* str = (char*)script->get_val2(st, reference_uid(id, idx), ref);
if( str && *str )
ret = idx + 1;
script_removetop(st, -1, 0);
@@ -5139,7 +5109,7 @@ static int32 getarraysize(struct script_state* st, int32 id, int32 idx, int isst
{
for( ; idx < SCRIPT_MAX_ARRAYSIZE; ++idx )
{
- int32 num = (int32)__64BPTRSIZE(get_val2(st, reference_uid(id, idx), ref));
+ int32 num = (int32)__64BPTRSIZE(script->get_val2(st, reference_uid(id, idx), ref));
if( num )
ret = idx + 1;
script_removetop(st, -1, 0);
@@ -5332,7 +5302,7 @@ BUILDIN(copyarray)
{// destination might be overlapping the source - copy in reverse order
for( i = count - 1; i >= 0; --i )
{
- v = get_val2(st, reference_uid(id2, idx2 + i), reference_getref(data2));
+ v = script->get_val2(st, reference_uid(id2, idx2 + i), reference_getref(data2));
set_reg(st, sd, reference_uid(id1, idx1 + i), name1, v, reference_getref(data1));
script_removetop(st, -1, 0);
}
@@ -5343,7 +5313,7 @@ BUILDIN(copyarray)
{
if( idx2 + i < SCRIPT_MAX_ARRAYSIZE )
{
- v = get_val2(st, reference_uid(id2, idx2 + i), reference_getref(data2));
+ v = script->get_val2(st, reference_uid(id2, idx2 + i), reference_getref(data2));
set_reg(st, sd, reference_uid(id1, idx1 + i), name1, v, reference_getref(data1));
script_removetop(st, -1, 0);
}
@@ -5445,7 +5415,7 @@ BUILDIN(deletearray)
// move rest of the elements backward
for( ; start + count < end; ++start )
{
- void* v = get_val2(st, reference_uid(id, start + count), reference_getref(data));
+ void* v = script->get_val2(st, reference_uid(id, start + count), reference_getref(data));
set_reg(st, sd, reference_uid(id, start), name, v, reference_getref(data));
script_removetop(st, -1, 0);
}
@@ -5507,7 +5477,7 @@ BUILDIN(getelementofarray)
return false;// out of range
}
- push_val2(st->stack, C_NAME, reference_uid(id, i), reference_getref(data));
+ script->push_val(st->stack, C_NAME, reference_uid(id, i), reference_getref(data));
return true;
}
@@ -5530,7 +5500,7 @@ BUILDIN(setlook)
if( sd == NULL )
return true;
- iPc->changelook(sd,type,val);
+ pc->changelook(sd,type,val);
return true;
}
@@ -5607,7 +5577,7 @@ BUILDIN(countitem)
}
data = script_getdata(st,2);
- get_val(st, data); // convert into value in case of a variable
+ script->get_val(st, data); // convert into value in case of a variable
if( data_isstring(data) )
{// item name
@@ -5654,7 +5624,7 @@ BUILDIN(countitem2)
}
data = script_getdata(st,2);
- get_val(st, data); // convert into value in case of a variable
+ script->get_val(st, data); // convert into value in case of a variable
if( data_isstring(data) )
{// item name
@@ -5719,11 +5689,11 @@ BUILDIN(checkweight)
script_pushint(st,0);
return false;
}
- slots = iPc->inventoryblank(sd); //nb of empty slot
+ slots = pc->inventoryblank(sd); //nb of empty slot
for(i=2; i<nbargs; i=i+2){
data = script_getdata(st,i);
- get_val(st, data); // convert into value in case of a variable
+ script->get_val(st, data); // convert into value in case of a variable
if( data_isstring(data) ){// item name
id = itemdb_searchname(script->conv_str(st, data));
} else {// item id
@@ -5750,7 +5720,7 @@ BUILDIN(checkweight)
return true;
}
- switch( iPc->checkadditem(sd, nameid, amount) )
+ switch( pc->checkadditem(sd, nameid, amount) )
{
case ADDITEM_EXIST:
// item is already in inventory, but there is still space for the requested amount
@@ -5833,11 +5803,11 @@ BUILDIN(checkweight2)
fail = 1;
}
- slots = iPc->inventoryblank(sd);
+ slots = pc->inventoryblank(sd);
for(i=0; i<nb_it; i++){
- nameid = (int32)__64BPTRSIZE(get_val2(st,reference_uid(id_it,idx_it+i),reference_getref(data_it)));
+ nameid = (int32)__64BPTRSIZE(script->get_val2(st,reference_uid(id_it,idx_it+i),reference_getref(data_it)));
script_removetop(st, -1, 0);
- amount = (int32)__64BPTRSIZE(get_val2(st,reference_uid(id_nb,idx_nb+i),reference_getref(data_nb)));
+ amount = (int32)__64BPTRSIZE(script->get_val2(st,reference_uid(id_nb,idx_nb+i),reference_getref(data_nb)));
script_removetop(st, -1, 0);
if(fail) continue; //cpntonie to depop rest
@@ -5856,7 +5826,7 @@ BUILDIN(checkweight2)
fail = 1;
continue;
}
- switch( iPc->checkadditem(sd, nameid, amount) ) {
+ switch( pc->checkadditem(sd, nameid, amount) ) {
case ADDITEM_EXIST:
// item is already in inventory, but there is still space for the requested amount
break;
@@ -5895,7 +5865,7 @@ BUILDIN(getitem)
struct item_data *item_data;
data=script_getdata(st,2);
- get_val(st,data);
+ script->get_val(st,data);
if( data_isstring(data) )
{// "<item name>"
const char *name=script->conv_str(st,data);
@@ -5950,10 +5920,10 @@ BUILDIN(getitem)
// if not pet egg
if (!pet_create_egg(sd, nameid))
{
- if ((flag = iPc->additem(sd, &it, get_count, LOG_TYPE_SCRIPT)))
+ if ((flag = pc->additem(sd, &it, get_count, LOG_TYPE_SCRIPT)))
{
clif->additem(sd, 0, 0, flag);
- if( iPc->candrop(sd,&it) )
+ if( pc->candrop(sd,&it) )
iMap->addflooritem(&it,get_count,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0);
}
}
@@ -5983,7 +5953,7 @@ BUILDIN(getitem2)
return true;
data=script_getdata(st,2);
- get_val(st,data);
+ script->get_val(st,data);
if( data_isstring(data) ){
const char *name=script->conv_str(st,data);
struct item_data *item_data = itemdb_searchname(name);
@@ -6048,10 +6018,10 @@ BUILDIN(getitem2)
// if not pet egg
if (!pet_create_egg(sd, nameid))
{
- if ((flag = iPc->additem(sd, &item_tmp, get_count, LOG_TYPE_SCRIPT)))
+ if ((flag = pc->additem(sd, &item_tmp, get_count, LOG_TYPE_SCRIPT)))
{
clif->additem(sd, 0, 0, flag);
- if( iPc->candrop(sd,&item_tmp) )
+ if( pc->candrop(sd,&item_tmp) )
iMap->addflooritem(&item_tmp,get_count,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0);
}
}
@@ -6074,7 +6044,7 @@ BUILDIN(rentitem)
int nameid = 0, flag;
data = script_getdata(st,2);
- get_val(st,data);
+ script->get_val(st,data);
if( (sd = script_rid2sd(st)) == NULL )
return true;
@@ -6111,7 +6081,7 @@ BUILDIN(rentitem)
it.identify = 1;
it.expire_time = (unsigned int)(time(NULL) + seconds);
- if( (flag = iPc->additem(sd, &it, 1, LOG_TYPE_SCRIPT)) )
+ if( (flag = pc->additem(sd, &it, 1, LOG_TYPE_SCRIPT)) )
{
clif->additem(sd, 0, 0, flag);
return false;
@@ -6141,7 +6111,7 @@ BUILDIN(getnameditem)
}
data=script_getdata(st,2);
- get_val(st,data);
+ script->get_val(st,data);
if( data_isstring(data) ){
const char *name=script->conv_str(st,data);
struct item_data *item_data = itemdb_searchname(name);
@@ -6161,7 +6131,7 @@ BUILDIN(getnameditem)
}
data=script_getdata(st,3);
- get_val(st,data);
+ script->get_val(st,data);
if( data_isstring(data) ) //Char Name
tsd=iMap->nick2sd(script->conv_str(st,data));
else //Char Id was given
@@ -6180,7 +6150,7 @@ BUILDIN(getnameditem)
item_tmp.card[0]=CARD0_CREATE; //we don't use 255! because for example SIGNED WEAPON shouldn't get TOP10 BS Fame bonus [Lupus]
item_tmp.card[2]=tsd->status.char_id;
item_tmp.card[3]=tsd->status.char_id >> 16;
- if(iPc->additem(sd,&item_tmp,1,LOG_TYPE_SCRIPT)) {
+ if(pc->additem(sd,&item_tmp,1,LOG_TYPE_SCRIPT)) {
script_pushint(st,0);
return true; //Failed to add item, we will not drop if they don't fit
}
@@ -6215,7 +6185,7 @@ BUILDIN(makeitem)
struct item_data *item_data;
data=script_getdata(st,2);
- get_val(st,data);
+ script->get_val(st,data);
if( data_isstring(data) ){
const char *name=script->conv_str(st,data);
if( (item_data = itemdb_searchname(name)) )
@@ -6272,7 +6242,7 @@ static void buildin_delitem_delete(struct map_session_data* sd, int idx, int* am
{// delete associated pet
intif_delete_petdata(MakeDWord(inv->card[1], inv->card[2]));
}
- iPc->delitem(sd, idx, delamount, 0, 0, LOG_TYPE_SCRIPT);
+ pc->delitem(sd, idx, delamount, 0, 0, LOG_TYPE_SCRIPT);
}
amount[0]-= delamount;
@@ -6427,7 +6397,7 @@ BUILDIN(delitem)
}
data = script_getdata(st,2);
- get_val(st,data);
+ script->get_val(st,data);
if( data_isstring(data) )
{
const char* item_name = script->conv_str(st,data);
@@ -6496,7 +6466,7 @@ BUILDIN(delitem2)
}
data = script_getdata(st,2);
- get_val(st,data);
+ script->get_val(st,data);
if( data_isstring(data) )
{
const char* item_name = script->conv_str(st,data);
@@ -6566,7 +6536,7 @@ BUILDIN(disableitemuse)
/*==========================================
* return the basic stats of sd
- * chk iPc->readparam for available type
+ * chk pc->readparam for available type
*------------------------------------------*/
BUILDIN(readparam)
{
@@ -6584,7 +6554,7 @@ BUILDIN(readparam)
return true;
}
- script_pushint(st,iPc->readparam(sd,type));
+ script_pushint(st,pc->readparam(sd,type));
return true;
}
@@ -6670,7 +6640,7 @@ BUILDIN(getpartyname)
party_id = script_getnum(st,2);
- if( ( p = iParty->search(party_id) ) != NULL )
+ if( ( p = party->search(party_id) ) != NULL )
{
script_pushstrcopy(st,p->party.name);
}
@@ -6694,7 +6664,7 @@ BUILDIN(getpartymember)
struct party_data *p;
int i,j=0,type=0;
- p=iParty->search(script_getnum(st,2));
+ p=party->search(script_getnum(st,2));
if( script_hasdata(st,3) )
type=script_getnum(st,3);
@@ -6734,7 +6704,7 @@ BUILDIN(getpartyleader)
if( script_hasdata(st,3) )
type=script_getnum(st,3);
- p=iParty->search(party_id);
+ p=party->search(party_id);
if (p) //Search leader
for(i = 0; i < MAX_PARTY && !p->party.member[i].leader; i++);
@@ -6847,7 +6817,7 @@ BUILDIN(strcharinfo)
script_pushstrcopy(st,sd->status.name);
break;
case 1:
- if( ( p = iParty->search(sd->status.party_id) ) != NULL ) {
+ if( ( p = party->search(sd->status.party_id) ) != NULL ) {
script_pushstrcopy(st,p->party.name);
} else {
script_pushconststr(st,"");
@@ -6951,7 +6921,7 @@ BUILDIN(getequipid)
}
// get inventory position of item
- i = iPc->checkequip(sd,equip[num]);
+ i = pc->checkequip(sd,equip[num]);
if( i < 0 )
{
script_pushint(st,-1);
@@ -6989,7 +6959,7 @@ BUILDIN(getequipname)
}
// get inventory position of item
- i = iPc->checkequip(sd,equip[num]);
+ i = pc->checkequip(sd,equip[num]);
if( i < 0 )
{
script_pushconststr(st,"");
@@ -7108,7 +7078,7 @@ BUILDIN(getequipisequiped)
return true;
if (num > 0 && num <= ARRAYLENGTH(equip))
- i=iPc->checkequip(sd,equip[num-1]);
+ i=pc->checkequip(sd,equip[num-1]);
if(i >= 0)
script_pushint(st,1);
@@ -7135,7 +7105,7 @@ BUILDIN(getequipisenableref)
return true;
if( num > 0 && num <= ARRAYLENGTH(equip) )
- i = iPc->checkequip(sd,equip[num-1]);
+ i = pc->checkequip(sd,equip[num-1]);
if( i >= 0 && sd->inventory_data[i] && !sd->inventory_data[i]->flag.no_refine && !sd->status.inventory[i].expire_time )
script_pushint(st,1);
else
@@ -7161,7 +7131,7 @@ BUILDIN(getequipisidentify)
return true;
if (num > 0 && num <= ARRAYLENGTH(equip))
- i=iPc->checkequip(sd,equip[num-1]);
+ i=pc->checkequip(sd,equip[num-1]);
if(i >= 0)
script_pushint(st,sd->status.inventory[i].identify);
else
@@ -7187,7 +7157,7 @@ BUILDIN(getequiprefinerycnt)
return true;
if (num > 0 && num <= ARRAYLENGTH(equip))
- i=iPc->checkequip(sd,equip[num-1]);
+ i=pc->checkequip(sd,equip[num-1]);
if(i >= 0)
script_pushint(st,sd->status.inventory[i].refine);
else
@@ -7214,7 +7184,7 @@ BUILDIN(getequipweaponlv)
return true;
if (num > 0 && num <= ARRAYLENGTH(equip))
- i=iPc->checkequip(sd,equip[num-1]);
+ i=pc->checkequip(sd,equip[num-1]);
if(i >= 0 && sd->inventory_data[i])
script_pushint(st,sd->inventory_data[i]->wlv);
else
@@ -7240,7 +7210,7 @@ BUILDIN(getequippercentrefinery)
return true;
if (num > 0 && num <= ARRAYLENGTH(equip))
- i=iPc->checkequip(sd,equip[num-1]);
+ i=pc->checkequip(sd,equip[num-1]);
if(i >= 0 && sd->status.inventory[i].nameid && sd->status.inventory[i].refine < MAX_REFINE)
script_pushint(st,status_get_refine_chance(itemdb_wlv(sd->status.inventory[i].nameid), (int)sd->status.inventory[i].refine));
else
@@ -7263,7 +7233,7 @@ BUILDIN(successrefitem)
return true;
if (num > 0 && num <= ARRAYLENGTH(equip))
- i=iPc->checkequip(sd,equip[num-1]);
+ i=pc->checkequip(sd,equip[num-1]);
if(i >= 0) {
ep=sd->status.inventory[i].equip;
@@ -7271,7 +7241,7 @@ BUILDIN(successrefitem)
logs->pick_pc(sd, LOG_TYPE_SCRIPT, -1, &sd->status.inventory[i],sd->inventory_data[i]);
sd->status.inventory[i].refine++;
- iPc->unequipitem(sd,i,2); // status calc will happen in iPc->equipitem() below
+ pc->unequipitem(sd,i,2); // status calc will happen in pc->equipitem() below
clif->refine(sd->fd,0,i,sd->status.inventory[i].refine);
clif->delitem(sd,i,1,3);
@@ -7280,7 +7250,7 @@ BUILDIN(successrefitem)
logs->pick_pc(sd, LOG_TYPE_SCRIPT, 1, &sd->status.inventory[i],sd->inventory_data[i]);
clif->additem(sd,i,1,0);
- iPc->equipitem(sd,i,ep);
+ pc->equipitem(sd,i,ep);
clif->misceffect(&sd->bl,3);
if(sd->status.inventory[i].refine == 10 &&
sd->status.inventory[i].card[0] == CARD0_FORGE &&
@@ -7288,13 +7258,13 @@ BUILDIN(successrefitem)
){ // Fame point system [DracoRPG]
switch (sd->inventory_data[i]->wlv){
case 1:
- iPc->addfame(sd,1); // Success to refine to +10 a lv1 weapon you forged = +1 fame point
+ pc->addfame(sd,1); // Success to refine to +10 a lv1 weapon you forged = +1 fame point
break;
case 2:
- iPc->addfame(sd,25); // Success to refine to +10 a lv2 weapon you forged = +25 fame point
+ pc->addfame(sd,25); // Success to refine to +10 a lv2 weapon you forged = +25 fame point
break;
case 3:
- iPc->addfame(sd,1000); // Success to refine to +10 a lv3 weapon you forged = +1000 fame point
+ pc->addfame(sd,1000); // Success to refine to +10 a lv3 weapon you forged = +1000 fame point
break;
}
}
@@ -7317,13 +7287,13 @@ BUILDIN(failedrefitem)
return true;
if (num > 0 && num <= ARRAYLENGTH(equip))
- i=iPc->checkequip(sd,equip[num-1]);
+ i=pc->checkequip(sd,equip[num-1]);
if(i >= 0) {
sd->status.inventory[i].refine = 0;
- iPc->unequipitem(sd,i,3); //recalculate bonus
+ pc->unequipitem(sd,i,3); //recalculate bonus
clif->refine(sd->fd,1,i,sd->status.inventory[i].refine); //notify client of failure
- iPc->delitem(sd,i,1,0,2,LOG_TYPE_SCRIPT);
+ pc->delitem(sd,i,1,0,2,LOG_TYPE_SCRIPT);
clif->misceffect(&sd->bl,2); // display failure effect
}
@@ -7345,7 +7315,7 @@ BUILDIN(downrefitem)
return true;
if (num > 0 && num <= ARRAYLENGTH(equip))
- i = iPc->checkequip(sd,equip[num-1]);
+ i = pc->checkequip(sd,equip[num-1]);
if(i >= 0) {
ep = sd->status.inventory[i].equip;
@@ -7353,7 +7323,7 @@ BUILDIN(downrefitem)
logs->pick_pc(sd, LOG_TYPE_SCRIPT, -1, &sd->status.inventory[i],sd->inventory_data[i]);
sd->status.inventory[i].refine++;
- iPc->unequipitem(sd,i,2); // status calc will happen in iPc->equipitem() below
+ pc->unequipitem(sd,i,2); // status calc will happen in pc->equipitem() below
clif->refine(sd->fd,2,i,sd->status.inventory[i].refine = sd->status.inventory[i].refine - 2);
clif->delitem(sd,i,1,3);
@@ -7362,7 +7332,7 @@ BUILDIN(downrefitem)
logs->pick_pc(sd, LOG_TYPE_SCRIPT, 1, &sd->status.inventory[i],sd->inventory_data[i]);
clif->additem(sd,i,1,0);
- iPc->equipitem(sd,i,ep);
+ pc->equipitem(sd,i,ep);
clif->misceffect(&sd->bl,2);
}
@@ -7383,10 +7353,10 @@ BUILDIN(delequip)
return true;
if (num > 0 && num <= ARRAYLENGTH(equip))
- i=iPc->checkequip(sd,equip[num-1]);
+ i=pc->checkequip(sd,equip[num-1]);
if(i >= 0) {
- iPc->unequipitem(sd,i,3); //recalculate bonus
- iPc->delitem(sd,i,1,0,2,LOG_TYPE_SCRIPT);
+ pc->unequipitem(sd,i,3); //recalculate bonus
+ pc->delitem(sd,i,1,0,2,LOG_TYPE_SCRIPT);
}
return true;
@@ -7405,7 +7375,7 @@ BUILDIN(statusup)
if( sd == NULL )
return true;
- iPc->statusup(sd,type);
+ pc->statusup(sd,type);
return true;
}
@@ -7423,7 +7393,7 @@ BUILDIN(statusup2)
if( sd == NULL )
return true;
- iPc->statusup2(sd,type,val);
+ pc->statusup2(sd,type,val);
return true;
}
@@ -7477,16 +7447,16 @@ BUILDIN(bonus)
switch( script_lastdata(st)-2 ) {
case 1:
- iPc->bonus(sd, type, val1);
+ pc->bonus(sd, type, val1);
break;
case 2:
val2 = script_getnum(st,4);
- iPc->bonus2(sd, type, val1, val2);
+ pc->bonus2(sd, type, val1, val2);
break;
case 3:
val2 = script_getnum(st,4);
val3 = script_getnum(st,5);
- iPc->bonus3(sd, type, val1, val2, val3);
+ pc->bonus3(sd, type, val1, val2, val3);
break;
case 4:
if( type == SP_AUTOSPELL_ONSKILL && script_isstring(st,4) )
@@ -7496,7 +7466,7 @@ BUILDIN(bonus)
val3 = script_getnum(st,5);
val4 = script_getnum(st,6);
- iPc->bonus4(sd, type, val1, val2, val3, val4);
+ pc->bonus4(sd, type, val1, val2, val3, val4);
break;
case 5:
if( type == SP_AUTOSPELL_ONSKILL && script_isstring(st,4) )
@@ -7507,7 +7477,7 @@ BUILDIN(bonus)
val3 = script_getnum(st,5);
val4 = script_getnum(st,6);
val5 = script_getnum(st,7);
- iPc->bonus5(sd, type, val1, val2, val3, val4, val5);
+ pc->bonus5(sd, type, val1, val2, val3, val4, val5);
break;
default:
ShowDebug("buildin_bonus: unexpected number of arguments (%d)\n", (script_lastdata(st) - 1));
@@ -7543,7 +7513,7 @@ BUILDIN(autobonus)
if( script_hasdata(st,6) )
other_script = script_getstr(st,6);
- if( iPc->addautobonus(sd->autobonus,ARRAYLENGTH(sd->autobonus),
+ if( pc->addautobonus(sd->autobonus,ARRAYLENGTH(sd->autobonus),
bonus_script,rate,dur,atk_type,other_script,sd->status.inventory[current_equip_item_index].equip,false) )
{
script_add_autobonus(bonus_script);
@@ -7580,7 +7550,7 @@ BUILDIN(autobonus2)
if( script_hasdata(st,6) )
other_script = script_getstr(st,6);
- if( iPc->addautobonus(sd->autobonus2,ARRAYLENGTH(sd->autobonus2),
+ if( pc->addautobonus(sd->autobonus2,ARRAYLENGTH(sd->autobonus2),
bonus_script,rate,dur,atk_type,other_script,sd->status.inventory[current_equip_item_index].equip,false) )
{
script_add_autobonus(bonus_script);
@@ -7615,7 +7585,7 @@ BUILDIN(autobonus3)
if( script_hasdata(st,6) )
other_script = script_getstr(st,6);
- if( iPc->addautobonus(sd->autobonus3,ARRAYLENGTH(sd->autobonus3),
+ if( pc->addautobonus(sd->autobonus3,ARRAYLENGTH(sd->autobonus3),
bonus_script,rate,dur,atk_type,other_script,sd->status.inventory[current_equip_item_index].equip,true) )
{
script_add_autobonus(bonus_script);
@@ -7651,7 +7621,7 @@ BUILDIN(skill)
level = script_getnum(st,3);
if( script_hasdata(st,4) )
flag = script_getnum(st,4);
- iPc->skill(sd, id, level, flag);
+ pc->skill(sd, id, level, flag);
return true;
}
@@ -7680,7 +7650,7 @@ BUILDIN(addtoskill)
level = script_getnum(st,3);
if( script_hasdata(st,4) )
flag = script_getnum(st,4);
- iPc->skill(sd, id, level, flag);
+ pc->skill(sd, id, level, flag);
return true;
}
@@ -7722,7 +7692,7 @@ BUILDIN(getskilllv)
return true;// no player attached, report source
id = ( script_isstring(st,2) ? skill->name2id(script_getstr(st,2)) : script_getnum(st,2) );
- script_pushint(st, iPc->checkskill(sd,id));
+ script_pushint(st, pc->checkskill(sd,id));
return true;
}
@@ -7770,7 +7740,7 @@ BUILDIN(getgmlevel)
if( sd == NULL )
return true;// no player attached, report source
- script_pushint(st, iPc->get_group_level(sd));
+ script_pushint(st, pc->get_group_level(sd));
return true;
}
@@ -7891,9 +7861,9 @@ BUILDIN(setoption)
if( flag ){// Add option
if( option&OPTION_WEDDING && !battle_config.wedding_modifydisplay )
option &= ~OPTION_WEDDING;// Do not show the wedding sprites
- iPc->setoption(sd, sd->sc.option|option);
+ pc->setoption(sd, sd->sc.option|option);
} else// Remove option
- iPc->setoption(sd, sd->sc.option&~option);
+ pc->setoption(sd, sd->sc.option&~option);
return true;
}
@@ -7941,7 +7911,7 @@ BUILDIN(setcart)
if( script_hasdata(st,2) )
type = script_getnum(st,2);
- iPc->setcart(sd, type);
+ pc->setcart(sd, type);
return true;
}
@@ -7984,7 +7954,7 @@ BUILDIN(setfalcon)
if( script_hasdata(st,2) )
flag = script_getnum(st,2);
- iPc->setfalcon(sd, flag);
+ pc->setfalcon(sd, flag);
return true;
}
@@ -8026,7 +7996,7 @@ BUILDIN(setriding)
if( script_hasdata(st,2) )
flag = script_getnum(st,2);
- iPc->setriding(sd, flag);
+ pc->setriding(sd, flag);
return true;
}
@@ -8087,7 +8057,7 @@ BUILDIN(setmadogear)
if( script_hasdata(st,2) )
flag = script_getnum(st,2);
- iPc->setmadogear(sd, flag);
+ pc->setmadogear(sd, flag);
return true;
}
@@ -8113,7 +8083,7 @@ BUILDIN(savepoint)
y = script_getnum(st,4);
map = mapindex_name2id(str);
if( map )
- iPc->setsavepoint(sd, map, x, y);
+ pc->setsavepoint(sd, map, x, y);
return true;
}
@@ -8360,7 +8330,7 @@ BUILDIN(getexp)
base = (int) cap_value(base * bonus, 0, INT_MAX);
job = (int) cap_value(job * bonus, 0, INT_MAX);
- iPc->gainexp(sd, NULL, base, job, true);
+ pc->gainexp(sd, NULL, base, job, true);
return true;
}
@@ -8789,7 +8759,7 @@ BUILDIN(addtimer)
if( sd == NULL )
return true;
- iPc->addeventtimer(sd,tick,event);
+ pc->addeventtimer(sd,tick,event);
return true;
}
/*==========================================
@@ -8805,7 +8775,7 @@ BUILDIN(deltimer)
return true;
check_event(st, event);
- iPc->deleventtimer(sd,event);
+ pc->deleventtimer(sd,event);
return true;
}
/*==========================================
@@ -8823,7 +8793,7 @@ BUILDIN(addtimercount)
return true;
check_event(st, event);
- iPc->addeventtimercount(sd,event,tick);
+ pc->addeventtimercount(sd,event,tick);
return true;
}
@@ -8843,7 +8813,7 @@ BUILDIN(initnpctimer)
{ //Check if argument is numeric (flag) or string (npc name)
struct script_data *data;
data = script_getdata(st,2);
- get_val(st,data);
+ script->get_val(st,data);
if( data_isstring(data) ) //NPC name
nd = npc_name2id(script->conv_str(st, data));
else if( data_isint(data) ) //Flag
@@ -8891,7 +8861,7 @@ BUILDIN(startnpctimer)
{ //Check if argument is numeric (flag) or string (npc name)
struct script_data *data;
data = script_getdata(st,2);
- get_val(st,data);
+ script->get_val(st,data);
if( data_isstring(data) ) //NPC name
nd = npc_name2id(script->conv_str(st, data));
else if( data_isint(data) ) //Flag
@@ -8937,7 +8907,7 @@ BUILDIN(stopnpctimer)
{ //Check if argument is numeric (flag) or string (npc name)
struct script_data *data;
data = script_getdata(st,2);
- get_val(st,data);
+ script->get_val(st,data);
if( data_isstring(data) ) //NPC name
nd = npc_name2id(script->conv_str(st, data));
else if( data_isint(data) ) //Flag
@@ -9170,7 +9140,7 @@ BUILDIN(itemeffect) {
nullpo_retr( 1, ( nd = (TBL_NPC *)iMap->id2bl( sd->npc_id ) ) );
data = script_getdata( st, 2 );
- get_val( st, data );
+ script->get_val( st, data );
if( data_isstring( data ) ){
const char *name = script->conv_str( st, data );
@@ -9292,11 +9262,11 @@ BUILDIN(getusersname)
sd = script_rid2sd(st);
if (!sd) return true;
- group_level = iPc->get_group_level(sd);
+ group_level = pc->get_group_level(sd);
iter = mapit_getallusers();
for( pl_sd = (TBL_PC*)mapit->first(iter); mapit->exists(iter); pl_sd = (TBL_PC*)mapit->next(iter) )
{
- if (pc_has_permission(pl_sd, PC_PERM_HIDE_SESSION) && iPc->get_group_level(pl_sd) > group_level)
+ if (pc_has_permission(pl_sd, PC_PERM_HIDE_SESSION) && pc->get_group_level(pl_sd) > group_level)
continue; // skip hidden sessions
/* Temporary fix for bugreport:1023.
@@ -9406,7 +9376,7 @@ BUILDIN(getareadropitem)
y1=script_getnum(st,6);
data=script_getdata(st,7);
- get_val(st,data);
+ script->get_val(st,data);
if( data_isstring(data) ){
const char *name=script->conv_str(st,data);
struct item_data *item_data = itemdb_searchname(name);
@@ -9833,7 +9803,7 @@ BUILDIN(eaclass)
}
class_ = sd->status.class_;
}
- script_pushint(st,iPc->jobid2mapid(class_));
+ script_pushint(st,pc->jobid2mapid(class_));
return true;
}
@@ -9850,7 +9820,7 @@ BUILDIN(roclass)
else
sex = 1; //Just use male when not found.
}
- script_pushint(st,iPc->mapid2jobid(class_, sex));
+ script_pushint(st,pc->mapid2jobid(class_, sex));
return true;
}
@@ -9891,7 +9861,7 @@ BUILDIN(resetlvl)
if( sd == NULL )
return true;
- iPc->resetlvl(sd,type);
+ pc->resetlvl(sd,type);
return true;
}
/*==========================================
@@ -9901,7 +9871,7 @@ BUILDIN(resetstatus)
{
TBL_PC *sd;
sd=script_rid2sd(st);
- iPc->resetstate(sd);
+ pc->resetstate(sd);
return true;
}
@@ -9912,7 +9882,7 @@ BUILDIN(resetskill)
{
TBL_PC *sd;
sd=script_rid2sd(st);
- iPc->resetskill(sd,1);
+ pc->resetskill(sd,1);
return true;
}
@@ -9923,7 +9893,7 @@ BUILDIN(skillpointcount)
{
TBL_PC *sd;
sd=script_rid2sd(st);
- script_pushint(st,sd->status.skill_point + iPc->resetskill(sd,2));
+ script_pushint(st,sd->status.skill_point + pc->resetskill(sd,2));
return true;
}
@@ -9974,10 +9944,10 @@ BUILDIN(changesex)
TBL_PC *sd = NULL;
sd = script_rid2sd(st);
- iPc->resetskill(sd,4);
+ pc->resetskill(sd,4);
// to avoid any problem with equipment and invalid sex, equipment is unequiped.
for( i=0; i<EQI_MAX; i++ )
- if( sd->equip_index[i] >= 0 ) iPc->unequipitem(sd, sd->equip_index[i], 3);
+ if( sd->equip_index[i] >= 0 ) pc->unequipitem(sd, sd->equip_index[i], 3);
chrif_changesex(sd);
return true;
}
@@ -10202,17 +10172,17 @@ BUILDIN(warpwaitingpc)
{// no zeny to cover set fee
break;
}
- iPc->payzeny(sd, cd->zeny, LOG_TYPE_NPC, NULL);
+ pc->payzeny(sd, cd->zeny, LOG_TYPE_NPC, NULL);
}
mapreg_setreg(reference_uid(add_str("$@warpwaitingpc"), i), sd->bl.id);
if( strcmp(map_name,"Random") == 0 )
- iPc->randomwarp(sd,CLR_TELEPORT);
+ pc->randomwarp(sd,CLR_TELEPORT);
else if( strcmp(map_name,"SavePoint") == 0 )
- iPc->setpos(sd, sd->status.save_point.map, sd->status.save_point.x, sd->status.save_point.y, CLR_TELEPORT);
+ pc->setpos(sd, sd->status.save_point.map, sd->status.save_point.x, sd->status.save_point.y, CLR_TELEPORT);
else
- iPc->setpos(sd, mapindex_name2id(map_name), x, y, CLR_OUTSIGHT);
+ pc->setpos(sd, mapindex_name2id(map_name), x, y, CLR_OUTSIGHT);
}
mapreg_setreg(add_str("$@warpwaitingpcnum"), i);
return true;
@@ -10268,7 +10238,7 @@ BUILDIN(isloggedin)
if (script_hasdata(st,3) && sd &&
sd->status.char_id != script_getnum(st,3))
sd = NULL;
- push_val(st->stack,C_INT,sd!=NULL);
+ script->push_val(st->stack,C_INT,sd!=NULL,NULL);
return true;
}
@@ -10368,7 +10338,7 @@ BUILDIN(getmapflag)
static int script_mapflag_pvp_sub(struct block_list *bl,va_list ap) {
TBL_PC* sd = (TBL_PC*)bl;
if (sd->pvp_timer == INVALID_TIMER) {
- sd->pvp_timer = iTimer->add_timer(iTimer->gettick() + 200, iPc->calc_pvprank_timer, sd->bl.id, 0);
+ sd->pvp_timer = iTimer->add_timer(iTimer->gettick() + 200, pc->calc_pvprank_timer, sd->bl.id, 0);
sd->pvp_rank = 0;
sd->pvp_lastusers = 0;
sd->pvp_point = 5;
@@ -10392,7 +10362,7 @@ BUILDIN(setmapflag)
if(script_hasdata(st,4)){
data = script_getdata(st,4);
- get_val(st, data);
+ script->get_val(st, data);
if( data_isstring(data) )
@@ -10599,7 +10569,7 @@ BUILDIN(pvpon)
if( sd->bl.m != m || sd->pvp_timer != INVALID_TIMER )
continue; // not applicable
- sd->pvp_timer = iTimer->add_timer(iTimer->gettick()+200,iPc->calc_pvprank_timer,sd->bl.id,0);
+ sd->pvp_timer = iTimer->add_timer(iTimer->gettick()+200,pc->calc_pvprank_timer,sd->bl.id,0);
sd->pvp_rank = 0;
sd->pvp_lastusers = 0;
sd->pvp_point = 5;
@@ -10616,7 +10586,7 @@ static int buildin_pvpoff_sub(struct block_list *bl,va_list ap)
TBL_PC* sd = (TBL_PC*)bl;
clif->pvpset(sd, 0, 0, 2);
if (sd->pvp_timer != INVALID_TIMER) {
- iTimer->delete_timer(sd->pvp_timer, iPc->calc_pvprank_timer);
+ iTimer->delete_timer(sd->pvp_timer, pc->calc_pvprank_timer);
sd->pvp_timer = INVALID_TIMER;
}
return 0;
@@ -10735,7 +10705,7 @@ static int buildin_maprespawnguildid_sub_pc(struct map_session_data* sd, va_list
(sd->status.guild_id != g_id && flag&2) || //Warp out outsiders
(sd->status.guild_id == 0) // Warp out players not in guild [Valaris]
)
- iPc->setpos(sd,sd->status.save_point.map,sd->status.save_point.x,sd->status.save_point.y,CLR_TELEPORT);
+ pc->setpos(sd,sd->status.save_point.map,sd->status.save_point.x,sd->status.save_point.y,CLR_TELEPORT);
return 1;
}
@@ -10936,8 +10906,8 @@ BUILDIN(requestguildinfo)
}
/// Returns the number of cards that have been compounded onto the specified equipped item.
-/// getequipcardcnt(<equipment slot>);
-BUILDIN(getequipcardcnt)
+/// getequpcardcnt(<equipment slot>);
+BUILDIN(getequpcardcnt)
{
int i=-1,j,num;
TBL_PC *sd;
@@ -10946,7 +10916,7 @@ BUILDIN(getequipcardcnt)
num=script_getnum(st,2);
sd=script_rid2sd(st);
if (num > 0 && num <= ARRAYLENGTH(equip))
- i=iPc->checkequip(sd,equip[num-1]);
+ i=pc->checkequip(sd,equip[num-1]);
if (i < 0 || !sd->inventory_data[i]) {
script_pushint(st,0);
@@ -10978,7 +10948,7 @@ BUILDIN(successremovecards) {
int num = script_getnum(st,2);
if (num > 0 && num <= ARRAYLENGTH(equip))
- i=iPc->checkequip(sd,equip[num-1]);
+ i=pc->checkequip(sd,equip[num-1]);
if (i < 0 || !sd->inventory_data[i]) {
return true;
@@ -10996,7 +10966,7 @@ BUILDIN(successremovecards) {
item_tmp.nameid = sd->status.inventory[i].card[c];
item_tmp.identify = 1;
- if((flag=iPc->additem(sd,&item_tmp,1,LOG_TYPE_SCRIPT))){ // get back the cart in inventory
+ if((flag=pc->additem(sd,&item_tmp,1,LOG_TYPE_SCRIPT))){ // get back the cart in inventory
clif->additem(sd,0,0,flag);
iMap->addflooritem(&item_tmp,1,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0);
}
@@ -11017,8 +10987,8 @@ BUILDIN(successremovecards) {
for (j = sd->inventory_data[i]->slot; j < MAX_SLOTS; j++)
item_tmp.card[j]=sd->status.inventory[i].card[j];
- iPc->delitem(sd,i,1,0,3,LOG_TYPE_SCRIPT);
- if((flag=iPc->additem(sd,&item_tmp,1,LOG_TYPE_SCRIPT))){ //chk if can be spawn in inventory otherwise put on floor
+ pc->delitem(sd,i,1,0,3,LOG_TYPE_SCRIPT);
+ if((flag=pc->additem(sd,&item_tmp,1,LOG_TYPE_SCRIPT))){ //chk if can be spawn in inventory otherwise put on floor
clif->additem(sd,0,0,flag);
iMap->addflooritem(&item_tmp,1,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0);
}
@@ -11042,7 +11012,7 @@ BUILDIN(failedremovecards) {
int typefail = script_getnum(st,3);
if (num > 0 && num <= ARRAYLENGTH(equip))
- i=iPc->checkequip(sd,equip[num-1]);
+ i=pc->checkequip(sd,equip[num-1]);
if (i < 0 || !sd->inventory_data[i])
return true;
@@ -11063,7 +11033,7 @@ BUILDIN(failedremovecards) {
item_tmp.nameid = sd->status.inventory[i].card[c];
item_tmp.identify = 1;
- if((flag=iPc->additem(sd,&item_tmp,1,LOG_TYPE_SCRIPT))){
+ if((flag=pc->additem(sd,&item_tmp,1,LOG_TYPE_SCRIPT))){
clif->additem(sd,0,0,flag);
iMap->addflooritem(&item_tmp,1,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0);
}
@@ -11073,7 +11043,7 @@ BUILDIN(failedremovecards) {
if(cardflag == 1) {
if(typefail == 0 || typefail == 2){ // destroy the item
- iPc->delitem(sd,i,1,0,2,LOG_TYPE_SCRIPT);
+ pc->delitem(sd,i,1,0,2,LOG_TYPE_SCRIPT);
}
if(typefail == 1){ // destroy the card
int flag;
@@ -11090,9 +11060,9 @@ BUILDIN(failedremovecards) {
for (j = sd->inventory_data[i]->slot; j < MAX_SLOTS; j++)
item_tmp.card[j]=sd->status.inventory[i].card[j];
- iPc->delitem(sd,i,1,0,2,LOG_TYPE_SCRIPT);
+ pc->delitem(sd,i,1,0,2,LOG_TYPE_SCRIPT);
- if((flag=iPc->additem(sd,&item_tmp,1,LOG_TYPE_SCRIPT))){
+ if((flag=pc->additem(sd,&item_tmp,1,LOG_TYPE_SCRIPT))){
clif->additem(sd,0,0,flag);
iMap->addflooritem(&item_tmp,1,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0);
}
@@ -11138,17 +11108,17 @@ BUILDIN(mapwarp) // Added by RoVeRT
for( i=0; i < g->max_member; i++)
{
if(g->member[i].sd && g->member[i].sd->bl.m==m){
- iPc->setpos(g->member[i].sd,index,x,y,CLR_TELEPORT);
+ pc->setpos(g->member[i].sd,index,x,y,CLR_TELEPORT);
}
}
}
break;
case 2:
- p = iParty->search(check_ID);
+ p = party->search(check_ID);
if(p){
for(i=0;i<MAX_PARTY; i++){
if(p->data[i].sd && p->data[i].sd->bl.m == m){
- iPc->setpos(p->data[i].sd,index,x,y,CLR_TELEPORT);
+ pc->setpos(p->data[i].sd,index,x,y,CLR_TELEPORT);
}
}
}
@@ -11211,7 +11181,7 @@ BUILDIN(marriage)
TBL_PC *sd=script_rid2sd(st);
TBL_PC *p_sd=iMap->nick2sd(partner);
- if(sd==NULL || p_sd==NULL || iPc->marriage(sd,p_sd) < 0){
+ if(sd==NULL || p_sd==NULL || pc->marriage(sd,p_sd) < 0){
script_pushint(st,0);
return true;
}
@@ -11233,7 +11203,7 @@ BUILDIN(wedding_effect)
BUILDIN(divorce)
{
TBL_PC *sd=script_rid2sd(st);
- if(sd==NULL || iPc->divorce(sd) < 0){
+ if(sd==NULL || pc->divorce(sd) < 0){
script_pushint(st,0);
return true;
}
@@ -11245,7 +11215,7 @@ BUILDIN(ispartneron)
{
TBL_PC *sd=script_rid2sd(st);
- if(sd==NULL || !iPc->ismarried(sd) ||
+ if(sd==NULL || !pc->ismarried(sd) ||
iMap->charid2sd(sd->status.partner_id) == NULL) {
script_pushint(st,0);
return true;
@@ -11311,7 +11281,7 @@ BUILDIN(warppartner)
TBL_PC *sd=script_rid2sd(st);
TBL_PC *p_sd=NULL;
- if(sd==NULL || !iPc->ismarried(sd) ||
+ if(sd==NULL || !pc->ismarried(sd) ||
(p_sd=iMap->charid2sd(sd->status.partner_id)) == NULL) {
script_pushint(st,0);
return true;
@@ -11323,7 +11293,7 @@ BUILDIN(warppartner)
mapindex = mapindex_name2id(str);
if (mapindex) {
- iPc->setpos(p_sd,mapindex,x,y,CLR_OUTSIGHT);
+ pc->setpos(p_sd,mapindex,x,y,CLR_OUTSIGHT);
script_pushint(st,1);
} else
script_pushint(st,0);
@@ -11387,7 +11357,7 @@ BUILDIN(guardian)
has_index = true;
} else if( script_hasdata(st,7) ){
data=script_getdata(st,7);
- get_val(st,data);
+ script->get_val(st,data);
if( data_isstring(data) )
{// "<event label>"
evt=script_getstr(st,7);
@@ -11490,7 +11460,7 @@ BUILDIN(getitemname)
struct script_data *data;
data=script_getdata(st,2);
- get_val(st,data);
+ script->get_val(st,data);
if( data_isstring(data) ){
const char *name=script->conv_str(st,data);
@@ -11618,7 +11588,7 @@ BUILDIN(setiteminfo)
/*==========================================
* Returns value from equipped item slot n [Lupus]
- getequipcardid(num,slot)
+ getequpcardid(num,slot)
where
num = eqip position slot
slot = 0,1,2,3 (Card Slot N)
@@ -11637,7 +11607,7 @@ BUILDIN(getequipcardid)
slot=script_getnum(st,3);
sd=script_rid2sd(st);
if (num > 0 && num <= ARRAYLENGTH(equip))
- i=iPc->checkequip(sd,equip[num-1]);
+ i=pc->checkequip(sd,equip[num-1]);
if(i >= 0 && slot>=0 && slot<4)
script_pushint(st,sd->status.inventory[i].card[slot]);
else
@@ -11735,22 +11705,22 @@ BUILDIN(getinventorylist)
if(!sd) return true;
for(i=0;i<MAX_INVENTORY;i++){
if(sd->status.inventory[i].nameid > 0 && sd->status.inventory[i].amount > 0){
- iPc->setreg(sd,reference_uid(add_str("@inventorylist_id"), j),sd->status.inventory[i].nameid);
- iPc->setreg(sd,reference_uid(add_str("@inventorylist_amount"), j),sd->status.inventory[i].amount);
- iPc->setreg(sd,reference_uid(add_str("@inventorylist_equip"), j),sd->status.inventory[i].equip);
- iPc->setreg(sd,reference_uid(add_str("@inventorylist_refine"), j),sd->status.inventory[i].refine);
- iPc->setreg(sd,reference_uid(add_str("@inventorylist_identify"), j),sd->status.inventory[i].identify);
- iPc->setreg(sd,reference_uid(add_str("@inventorylist_attribute"), j),sd->status.inventory[i].attribute);
+ pc->setreg(sd,reference_uid(add_str("@inventorylist_id"), j),sd->status.inventory[i].nameid);
+ pc->setreg(sd,reference_uid(add_str("@inventorylist_amount"), j),sd->status.inventory[i].amount);
+ pc->setreg(sd,reference_uid(add_str("@inventorylist_equip"), j),sd->status.inventory[i].equip);
+ pc->setreg(sd,reference_uid(add_str("@inventorylist_refine"), j),sd->status.inventory[i].refine);
+ pc->setreg(sd,reference_uid(add_str("@inventorylist_identify"), j),sd->status.inventory[i].identify);
+ pc->setreg(sd,reference_uid(add_str("@inventorylist_attribute"), j),sd->status.inventory[i].attribute);
for (k = 0; k < MAX_SLOTS; k++)
{
sprintf(card_var, "@inventorylist_card%d",k+1);
- iPc->setreg(sd,reference_uid(add_str(card_var), j),sd->status.inventory[i].card[k]);
+ pc->setreg(sd,reference_uid(add_str(card_var), j),sd->status.inventory[i].card[k]);
}
- iPc->setreg(sd,reference_uid(add_str("@inventorylist_expire"), j),sd->status.inventory[i].expire_time);
+ pc->setreg(sd,reference_uid(add_str("@inventorylist_expire"), j),sd->status.inventory[i].expire_time);
j++;
}
}
- iPc->setreg(sd,add_str("@inventorylist_count"),j);
+ pc->setreg(sd,add_str("@inventorylist_count"),j);
return true;
}
@@ -11761,13 +11731,13 @@ BUILDIN(getskilllist)
if(!sd) return true;
for(i=0;i<MAX_SKILL;i++){
if(sd->status.skill[i].id > 0 && sd->status.skill[i].lv > 0){
- iPc->setreg(sd,reference_uid(add_str("@skilllist_id"), j),sd->status.skill[i].id);
- iPc->setreg(sd,reference_uid(add_str("@skilllist_lv"), j),sd->status.skill[i].lv);
- iPc->setreg(sd,reference_uid(add_str("@skilllist_flag"), j),sd->status.skill[i].flag);
+ pc->setreg(sd,reference_uid(add_str("@skilllist_id"), j),sd->status.skill[i].id);
+ pc->setreg(sd,reference_uid(add_str("@skilllist_lv"), j),sd->status.skill[i].lv);
+ pc->setreg(sd,reference_uid(add_str("@skilllist_flag"), j),sd->status.skill[i].flag);
j++;
}
}
- iPc->setreg(sd,add_str("@skilllist_count"),j);
+ pc->setreg(sd,add_str("@skilllist_count"),j);
return true;
}
@@ -11778,7 +11748,7 @@ BUILDIN(clearitem)
if(sd==NULL) return true;
for (i=0; i<MAX_INVENTORY; i++) {
if (sd->status.inventory[i].amount) {
- iPc->delitem(sd, i, sd->status.inventory[i].amount, 0, 0, LOG_TYPE_SCRIPT);
+ pc->delitem(sd, i, sd->status.inventory[i].amount, 0, 0, LOG_TYPE_SCRIPT);
}
}
return true;
@@ -11796,7 +11766,7 @@ BUILDIN(disguise)
id = script_getnum(st,2);
if (mobdb_checkid(id) || npcdb_checkid(id)) {
- iPc->disguise(sd, id);
+ pc->disguise(sd, id);
script_pushint(st,id);
} else
script_pushint(st,0);
@@ -11813,7 +11783,7 @@ BUILDIN(undisguise)
if (sd == NULL) return true;
if (sd->disguise != -1) {
- iPc->disguise(sd, -1);
+ pc->disguise(sd, -1);
script_pushint(st,0);
} else {
script_pushint(st,1);
@@ -12257,7 +12227,7 @@ BUILDIN(nude)
if( sd->equip_index[ i ] >= 0 ) {
if( !calcflag )
calcflag = 1;
- iPc->unequipitem( sd , sd->equip_index[ i ] , 2);
+ pc->unequipitem( sd , sd->equip_index[ i ] , 2);
}
}
@@ -13116,12 +13086,12 @@ BUILDIN(getrefine)
*-------------------------------------------------------*/
BUILDIN(night)
{
- if (iMap->night_flag != 1) iPc->map_night_timer(iPc->night_timer_tid, 0, 0, 1);
+ if (iMap->night_flag != 1) pc->map_night_timer(pc->night_timer_tid, 0, 0, 1);
return true;
}
BUILDIN(day)
{
- if (iMap->night_flag != 0) iPc->map_day_timer(iPc->day_timer_tid, 0, 0, 1);
+ if (iMap->night_flag != 0) pc->map_day_timer(pc->day_timer_tid, 0, 0, 1);
return true;
}
@@ -13138,9 +13108,9 @@ BUILDIN(unequip)
sd = script_rid2sd(st);
if( sd != NULL && num >= 1 && num <= ARRAYLENGTH(equip) )
{
- i = iPc->checkequip(sd,equip[num-1]);
+ i = pc->checkequip(sd,equip[num-1]);
if (i >= 0)
- iPc->unequipitem(sd,i,1|2);
+ pc->unequipitem(sd,i,1|2);
}
return true;
}
@@ -13161,7 +13131,7 @@ BUILDIN(equip)
}
ARR_FIND( 0, MAX_INVENTORY, i, sd->status.inventory[i].nameid == nameid );
if( i < MAX_INVENTORY )
- iPc->equipitem(sd,i,item_data->equip);
+ pc->equipitem(sd,i,item_data->equip);
return true;
}
@@ -13550,7 +13520,7 @@ BUILDIN(implode)
sprintf(output,"%s","NULL");
} else {
for(i = 0; i <= array_size; ++i) {
- temp = (char*) get_val2(st, reference_uid(id, i), reference_getref(data));
+ temp = (char*) script->get_val2(st, reference_uid(id, i), reference_getref(data));
len += strlen(temp);
script_removetop(st, -1, 0);
}
@@ -13565,7 +13535,7 @@ BUILDIN(implode)
//build output
for(i = 0; i < array_size; ++i) {
- temp = (char*) get_val2(st, reference_uid(id, i), reference_getref(data));
+ temp = (char*) script->get_val2(st, reference_uid(id, i), reference_getref(data));
len = strlen(temp);
memcpy(&output[k], temp, len);
k += len;
@@ -13575,7 +13545,7 @@ BUILDIN(implode)
}
script_removetop(st, -1, 0);
}
- temp = (char*) get_val2(st, reference_uid(id, array_size), reference_getref(data));
+ temp = (char*) script->get_val2(st, reference_uid(id, array_size), reference_getref(data));
len = strlen(temp);
memcpy(&output[k], temp, len);
k += len;
@@ -14030,14 +14000,14 @@ BUILDIN(setnpcdisplay)
if( script_hasdata(st,5) )
size = script_getnum(st,5);
- get_val(st, data);
+ script->get_val(st, data);
if( data_isstring(data) )
newname = script->conv_str(st,data);
else if( data_isint(data) )
class_ = script->conv_num(st,data);
else
{
- ShowError("script:setnpcdisplay: expected a string or number\n");
+ ShowError("script:setnpcdisplay: expected string or number\n");
script_reportdata(data);
return false;
}
@@ -14295,7 +14265,7 @@ BUILDIN(getd)
elem = 0;
// Push the 'pointer' so it's more flexible [Lance]
- push_val(st->stack, C_NAME, reference_uid(add_str(varname), elem));
+ script->push_val(st->stack, C_NAME, reference_uid(add_str(varname), elem),NULL);
return true;
}
@@ -14835,7 +14805,7 @@ BUILDIN(pcfollow)
sd = script_rid2sd(st);
if(sd)
- iPc->follow(sd, targetid);
+ pc->follow(sd, targetid);
return true;
}
@@ -14854,7 +14824,7 @@ BUILDIN(pcstopfollow)
sd = script_rid2sd(st);
if(sd)
- iPc->stop_following(sd);
+ pc->stop_following(sd);
return true;
}
@@ -14961,7 +14931,7 @@ BUILDIN(unitattack)
}
data = script_getdata(st, 3);
- get_val(st, data);
+ script->get_val(st, data);
if( data_isstring(data) )
{
TBL_PC* sd = iMap->nick2sd(script->conv_str(st, data));
@@ -15264,7 +15234,7 @@ BUILDIN(getvariableofnpc)
return false;
}
- push_val2(st->stack, C_NAME, reference_getuid(data), &nd->u.scr.script->script_vars );
+ script->push_val(st->stack, C_NAME, reference_getuid(data), &nd->u.scr.script->script_vars );
return true;
}
@@ -15728,7 +15698,7 @@ BUILDIN(waitingroom2bg_single)
if( bg_team_join(bg_id, sd) )
{
- iPc->setpos(sd, mapindex, x, y, CLR_TELEPORT);
+ pc->setpos(sd, mapindex, x, y, CLR_TELEPORT);
script_pushint(st,1);
}
else
@@ -16133,7 +16103,7 @@ BUILDIN(has_instance) {
if( i != sd->instances )
instance_id = sd->instance[i];
}
- if( instance_id == -1 && sd->status.party_id && (p = iParty->search(sd->status.party_id)) && p->instances ) {
+ if( instance_id == -1 && sd->status.party_id && (p = party->search(sd->status.party_id)) && p->instances ) {
for( i = 0; i < p->instances; i++ ) {
ARR_FIND(0, instances[p->instance[i]].num_map, j, map[instances[p->instance[i]].map[j]].instance_src_map == m);
if( j != instances[p->instance[i]].num_map )
@@ -16167,7 +16137,7 @@ static int buildin_instance_warpall_sub(struct block_list *bl,va_list ap) {
int x = va_arg(ap,int);
int y = va_arg(ap,int);
- iPc->setpos(sd,mapindex,x,y,CLR_TELEPORT);
+ pc->setpos(sd,mapindex,x,y,CLR_TELEPORT);
return 0;
}
@@ -16230,7 +16200,7 @@ BUILDIN(instance_check_party) {
party_id = script_getnum(st,2);
else return true;
- if( !(p = iParty->search(party_id)) ){
+ if( !(p = party->search(party_id)) ){
script_pushint(st, 0); // Returns false if party does not exist.
return true;
}
@@ -16524,10 +16494,10 @@ BUILDIN(setdragon) {
if( (sd = script_rid2sd(st)) == NULL )
return true;
- if( !iPc->checkskill(sd,RK_DRAGONTRAINING) || (sd->class_&MAPID_THIRDMASK) != MAPID_RUNE_KNIGHT )
+ if( !pc->checkskill(sd,RK_DRAGONTRAINING) || (sd->class_&MAPID_THIRDMASK) != MAPID_RUNE_KNIGHT )
script_pushint(st,0);//Doesn't have the skill or it's not a Rune Knight
else if ( pc_isridingdragon(sd) ) {//Is mounted; release
- iPc->setoption(sd, sd->sc.option&~OPTION_DRAGON);
+ pc->setoption(sd, sd->sc.option&~OPTION_DRAGON);
script_pushint(st,1);
} else {//Not mounted; Mount now.
unsigned int option = OPTION_DRAGON1;
@@ -16542,7 +16512,7 @@ BUILDIN(setdragon) {
option = OPTION_DRAGON1;
}
}
- iPc->setoption(sd, sd->sc.option|option);
+ pc->setoption(sd, sd->sc.option|option);
script_pushint(st,1);
}
return true;
@@ -16921,9 +16891,9 @@ BUILDIN(getrandgroupitem) {
for (i = 0; i < qty; i += get_count) {
// if not pet egg
if (!pet_create_egg(sd, nameid)) {
- if ((flag = iPc->additem(sd, &item_tmp, get_count, LOG_TYPE_SCRIPT))) {
+ if ((flag = pc->additem(sd, &item_tmp, get_count, LOG_TYPE_SCRIPT))) {
clif->additem(sd, 0, 0, flag);
- if( iPc->candrop(sd,&item_tmp) )
+ if( pc->candrop(sd,&item_tmp) )
iMap->addflooritem(&item_tmp,get_count,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0);
}
}
@@ -17332,9 +17302,9 @@ BUILDIN(qiclear) {
bool script_hp_add(char *name, char *args, bool (*func)(struct script_state *st)) {
int n = add_str(name), i = 0;
- if( str_data[n].type == C_FUNC ) {
- str_data[n].func = func;
- i = str_data[n].val;
+ if( script->str_data[n].type == C_FUNC ) {
+ script->str_data[n].func = func;
+ i = script->str_data[n].val;
if( args ) {
int slen = strlen(args);
if( script->buildin[i] ) {
@@ -17350,9 +17320,9 @@ bool script_hp_add(char *name, char *args, bool (*func)(struct script_state *st)
} else {
i = script->buildin_count;
- str_data[n].type = C_FUNC;
- str_data[n].val = i;
- str_data[n].func = func;
+ script->str_data[n].type = C_FUNC;
+ script->str_data[n].val = i;
+ script->str_data[n].func = func;
RECREATE(script->buildin, char *, ++script->buildin_count);
@@ -17563,7 +17533,7 @@ void script_parse_builtin(void) {
BUILDIN_DEF(getcastledata,"si"),
BUILDIN_DEF(setcastledata,"sii"),
BUILDIN_DEF(requestguildinfo,"i?"),
- BUILDIN_DEF(getequipcardcnt,"i"),
+ BUILDIN_DEF(getequpcardcnt,"i"),
BUILDIN_DEF(successremovecards,"i"),
BUILDIN_DEF(failedremovecards,"ii"),
BUILDIN_DEF(marriage,"s"),
@@ -17864,12 +17834,12 @@ void script_parse_builtin(void) {
else if (!strcmp(BUILDIN[i].name, "callfunc")) buildin_callfunc_ref = n;
else if (!strcmp(BUILDIN[i].name, "getelementofarray") ) buildin_getelementofarray_ref = n;
- if( str_data[n].func && str_data[n].func != BUILDIN[i].func )
+ if( script->str_data[n].func && script->str_data[n].func != BUILDIN[i].func )
continue;/* something replaced it, skip. */
- str_data[n].type = C_FUNC;
- str_data[n].val = offset;
- str_data[n].func = BUILDIN[i].func;
+ script->str_data[n].type = C_FUNC;
+ script->str_data[n].val = offset;
+ script->str_data[n].func = BUILDIN[i].func;
/* we only store the arguments, its the only thing used out of this */
if( slen ) {
@@ -17895,6 +17865,13 @@ void script_defaults(void) {
script->buildin_count = 0;
script->buildin = NULL;
+ script->str_data = NULL;
+ script->str_data_size = 0;
+ script->str_num = LABEL_START;
+ script->str_buf = NULL;
+ script->str_size = 0;
+ script->str_pos = 0;
+
script->init = do_init_script;
script->final = do_final_script;
@@ -17903,6 +17880,12 @@ void script_defaults(void) {
script->conv_num = conv_num;
script->conv_str = conv_str;
script->rid2sd = script_rid2sd;
+ script->push_val = push_val;
+ script->get_val = get_val;
+ script->get_val2 = get_val2;
+ script->push_str = push_str;
+ script->push_copy = push_copy;
+ script->pop_stack = pop_stack;
script->queue = script_hqueue_get;
script->queue_add = script_hqueue_add;
diff --git a/src/map/script.h b/src/map/script.h
index 2e8dde5cf..ab4a58626 100644
--- a/src/map/script.h
+++ b/src/map/script.h
@@ -214,6 +214,24 @@ int script_reload(void);
// @commands (script based)
void setd_sub(struct script_state *st, struct map_session_data *sd, const char *varname, int elem, void *value, struct DBMap **ref);
+struct script_function {
+ bool (*func)(struct script_state *st);
+ char *name;
+ char *arg;
+};
+
+// String buffer structures.
+// str_data stores string information
+struct str_data_struct {
+ enum c_op type;
+ int str;
+ int backpatch;
+ int label;
+ bool (*func)(struct script_state *st);
+ int val;
+ int next;
+};
+
///////////////////////////////////////////////////////////////////////////////
//## TODO possible enhancements: [FlavioJS]
// - 'callfunc' supporting labels in the current npc "::LabelName"
@@ -237,17 +255,17 @@ void setd_sub(struct script_state *st, struct map_session_data *sd, const char *
/// Returns the index of the last data in the stack
#define script_lastdata(st) ( (st)->end - (st)->start - 1 )
/// Pushes an int into the stack
-#define script_pushint(st,val) push_val((st)->stack, C_INT, (val))
+#define script_pushint(st,val) script->push_val((st)->stack, C_INT, (val),NULL)
/// Pushes a string into the stack (script engine frees it automatically)
-#define script_pushstr(st,val) push_str((st)->stack, C_STR, (val))
+#define script_pushstr(st,val) script->push_str((st)->stack, C_STR, (val))
/// Pushes a copy of a string into the stack
-#define script_pushstrcopy(st,val) push_str((st)->stack, C_STR, aStrdup(val))
+#define script_pushstrcopy(st,val) script->push_str((st)->stack, C_STR, aStrdup(val))
/// Pushes a constant string into the stack (must never change or be freed)
-#define script_pushconststr(st,val) push_str((st)->stack, C_CONSTSTR, (val))
+#define script_pushconststr(st,val) script->push_str((st)->stack, C_CONSTSTR, (val))
/// Pushes a nil into the stack
-#define script_pushnil(st) push_val((st)->stack, C_NOP, 0)
+#define script_pushnil(st) script->push_val((st)->stack, C_NOP, 0,NULL)
/// Pushes a copy of the data in the target index
-#define script_pushcopy(st,i) push_copy((st)->stack, (st)->start + (i))
+#define script_pushcopy(st,i) script->push_copy((st)->stack, (st)->start + (i))
#define script_isstring(st,i) data_isstring(script_getdata(st,i))
#define script_isint(st,i) data_isint(script_getdata(st,i))
@@ -262,9 +280,9 @@ void setd_sub(struct script_state *st, struct map_session_data *sd, const char *
/// Returns the script_data at the target index relative to the top of the stack
#define script_getdatatop(st,i) ( &((st)->stack->stack_data[(st)->stack->sp + (i)]) )
/// Pushes a copy of the data in the target index relative to the top of the stack
-#define script_pushcopytop(st,i) push_copy((st)->stack, (st)->stack->sp + (i))
+#define script_pushcopytop(st,i) script->push_copy((st)->stack, (st)->stack->sp + (i))
/// Removes the range of values [start,end[ relative to the top of the stack
-#define script_removetop(st,start,end) ( pop_stack((st), ((st)->stack->sp + (start)), (st)->stack->sp + (end)) )
+#define script_removetop(st,start,end) ( script->pop_stack((st), ((st)->stack->sp + (start)), (st)->stack->sp + (end)) )
//
// struct script_data* data;
@@ -282,12 +300,12 @@ void setd_sub(struct script_state *st, struct map_session_data *sd, const char *
#define data_isfunclabel(data) ( (data)->type == C_USERFUNC_POS )
/// Returns if this is a reference to a constant
-#define reference_toconstant(data) ( str_data[reference_getid(data)].type == C_INT )
+#define reference_toconstant(data) ( script->str_data[reference_getid(data)].type == C_INT )
/// Returns if this a reference to a param
-#define reference_toparam(data) ( str_data[reference_getid(data)].type == C_PARAM )
+#define reference_toparam(data) ( script->str_data[reference_getid(data)].type == C_PARAM )
/// Returns if this a reference to a variable
//##TODO confirm it's C_NAME [FlavioJS]
-#define reference_tovariable(data) ( str_data[reference_getid(data)].type == C_NAME )
+#define reference_tovariable(data) ( script->str_data[reference_getid(data)].type == C_NAME )
/// Returns the unique id of the reference (id and index)
#define reference_getuid(data) ( (data)->u.num )
/// Returns the id of the reference
@@ -295,13 +313,13 @@ void setd_sub(struct script_state *st, struct map_session_data *sd, const char *
/// Returns the array index of the reference
#define reference_getindex(data) ( (int32)(((uint32)(reference_getuid(data) & 0xff000000)) >> 24) )
/// Returns the name of the reference
-#define reference_getname(data) ( str_buf + str_data[reference_getid(data)].str )
+#define reference_getname(data) ( script->str_buf + script->str_data[reference_getid(data)].str )
/// Returns the linked list of uid-value pairs of the reference (can be NULL)
#define reference_getref(data) ( (data)->ref )
/// Returns the value of the constant
-#define reference_getconstant(data) ( str_data[reference_getid(data)].val )
+#define reference_getconstant(data) ( script->str_data[reference_getid(data)].val )
/// Returns the type of param
-#define reference_getparamtype(data) ( str_data[reference_getid(data)].val )
+#define reference_getparamtype(data) ( script->str_data[reference_getid(data)].val )
/// Composes the uid of a reference from the id and the index
#define reference_uid(id,idx) ( (int32)((((uint32)(id)) & 0x00ffffff) | (((uint32)(idx)) << 24)) )
@@ -313,12 +331,6 @@ void setd_sub(struct script_state *st, struct map_session_data *sd, const char *
#define BUILDIN(x) bool buildin_ ## x (struct script_state* st)
#define BUILDIN_A(x) buildin_ ## x
-struct script_function {
- bool (*func)(struct script_state *st);
- char *name;
- char *arg;
-};
-
/* script.c interface (incomplete) */
struct script_interface {
/* */
@@ -329,6 +341,14 @@ struct script_interface {
/* */
char **buildin;
unsigned int buildin_count;
+ /* */
+ struct str_data_struct *str_data;
+ int str_data_size; // size of the data
+ int str_num; // next id to be assigned
+ // str_buf holds the strings themselves
+ char *str_buf;
+ int str_size; // size of the buffer
+ int str_pos; // next position to be assigned
/* */
void (*init) (void);
void (*final) (void);
@@ -338,6 +358,12 @@ struct script_interface {
int (*conv_num) (struct script_state *st,struct script_data *data);
const char* (*conv_str) (struct script_state *st,struct script_data *data);
TBL_PC *(*rid2sd) (struct script_state *st);
+ struct script_data* (*push_val)(struct script_stack* stack, enum c_op type, int val, struct DBMap** ref);
+ void (*get_val) (struct script_state* st, struct script_data* data);
+ void* (*get_val2) (struct script_state* st, int uid, struct DBMap** ref);
+ struct script_data* (*push_str) (struct script_stack* stack, enum c_op type, char* str);
+ struct script_data* (*push_copy) (struct script_stack* stack, int pos);
+ void (*pop_stack) (struct script_state* st, int start, int end);
/* */
struct hQueue *(*queue) (int idx);
bool (*queue_add) (int idx, int var);
diff --git a/src/map/skill.c b/src/map/skill.c
index 676a6e463..15c133dc1 100644
--- a/src/map/skill.c
+++ b/src/map/skill.c
@@ -248,7 +248,7 @@ int skill_get_fixed_cast( uint16 skill_id ,uint16 skill_lv ){ skill_get2 (skill_
int skill_tree_get_max(uint16 skill_id, int b_class)
{
int i;
- b_class = iPc->class2idx(b_class);
+ b_class = pc->class2idx(b_class);
ARR_FIND( 0, MAX_SKILL_TREE, i, skill_tree[b_class][i].id == 0 || skill_tree[b_class][i].id == skill_id );
if( i < MAX_SKILL_TREE && skill_tree[b_class][i].id == skill_id )
@@ -322,7 +322,7 @@ int skill_get_range2 (struct block_list *bl, uint16 skill_id, uint16 skill_lv) {
case RA_AIMEDBOLT:
case RA_WUGBITE:
if( bl->type == BL_PC )
- range += iPc->checkskill((TBL_PC*)bl, AC_VULTURE);
+ range += pc->checkskill((TBL_PC*)bl, AC_VULTURE);
else
range += 10; //Assume level 10?
break;
@@ -333,13 +333,13 @@ int skill_get_range2 (struct block_list *bl, uint16 skill_id, uint16 skill_lv) {
case GS_SPREADATTACK:
case GS_GROUNDDRIFT:
if (bl->type == BL_PC)
- range += iPc->checkskill((TBL_PC*)bl, GS_SNAKEEYE);
+ range += pc->checkskill((TBL_PC*)bl, GS_SNAKEEYE);
else
range += 10; //Assume level 10?
break;
case NJ_KIRIKAGE:
if (bl->type == BL_PC)
- range = skill->get_range(NJ_SHADOWJUMP,iPc->checkskill((TBL_PC*)bl,NJ_SHADOWJUMP));
+ range = skill->get_range(NJ_SHADOWJUMP,pc->checkskill((TBL_PC*)bl,NJ_SHADOWJUMP));
break;
/**
* Warlock
@@ -357,7 +357,7 @@ int skill_get_range2 (struct block_list *bl, uint16 skill_id, uint16 skill_lv) {
case WL_TETRAVORTEX:
case WL_RELEASE:
if( bl->type == BL_PC )
- range += iPc->checkskill((TBL_PC*)bl, WL_RADIUS);
+ range += pc->checkskill((TBL_PC*)bl, WL_RADIUS);
break;
/**
* Ranger Bonus
@@ -370,7 +370,7 @@ int skill_get_range2 (struct block_list *bl, uint16 skill_id, uint16 skill_lv) {
case RA_FIRINGTRAP:
case RA_ICEBOUNDTRAP:
if( bl->type == BL_PC )
- range += (1 + iPc->checkskill((TBL_PC*)bl, RA_RESEARCHTRAP))/2;
+ range += (1 + pc->checkskill((TBL_PC*)bl, RA_RESEARCHTRAP))/2;
}
if( !range && bl->type != BL_PC )
@@ -392,7 +392,7 @@ int skill_calc_heal(struct block_list *src, struct block_list *target, uint16 sk
hp = 30+5*skill_lv+5*(status_get_vit(src)/10); // HP recovery
#endif
if( sd )
- hp += 5*iPc->checkskill(sd,BA_MUSICALLESSON);
+ hp += 5*pc->checkskill(sd,BA_MUSICALLESSON);
break;
case PR_SANCTUARY:
hp = (skill_lv>6)?777:skill_lv*100;
@@ -410,9 +410,9 @@ int skill_calc_heal(struct block_list *src, struct block_list *target, uint16 sk
**/
hp = (status_get_lv(src) + status_get_int(src)) / 5 * 30 * skill_lv / 10;
#else
- hp = ( status_get_lv(src) + status_get_int(src) ) / 8 * (4 + ( skill_id == AB_HIGHNESSHEAL ? ( sd ? iPc->checkskill(sd,AL_HEAL) : 10 ) : skill_lv ) * 8);
+ hp = ( status_get_lv(src) + status_get_int(src) ) / 8 * (4 + ( skill_id == AB_HIGHNESSHEAL ? ( sd ? pc->checkskill(sd,AL_HEAL) : 10 ) : skill_lv ) * 8);
#endif
- if( sd && ((skill = iPc->checkskill(sd, HP_MEDITATIO)) > 0) )
+ if( sd && ((skill = pc->checkskill(sd, HP_MEDITATIO)) > 0) )
hp += hp * skill * 2 / 100;
else if( src->type == BL_HOM && (skill = homun->checkskill(((TBL_HOM*)src), HLIF_BRAIN)) > 0 )
hp += hp * skill * 2 / 100;
@@ -422,10 +422,10 @@ int skill_calc_heal(struct block_list *src, struct block_list *target, uint16 sk
if( ( (target && target->type == BL_MER) || !heal ) && skill_id != NPC_EVILLAND )
hp >>= 1;
- if( sd && (skill = iPc->skillheal_bonus(sd, skill_id)) )
+ if( sd && (skill = pc->skillheal_bonus(sd, skill_id)) )
hp += hp*skill/100;
- if( tsd && (skill = iPc->skillheal2_bonus(tsd, skill_id)) )
+ if( tsd && (skill = pc->skillheal2_bonus(tsd, skill_id)) )
hp += hp*skill/100;
sc = status_get_sc(target);
@@ -814,19 +814,19 @@ int skill_additional_effect (struct block_list* src, struct block_list *bl, uint
break; // If a normal attack is a skill, it's splash damage. [Inkfish]
if(sd) {
// Automatic trigger of Blitz Beat
- if (pc_isfalcon(sd) && sd->status.weapon == W_BOW && (temp=iPc->checkskill(sd,HT_BLITZBEAT))>0 &&
+ if (pc_isfalcon(sd) && sd->status.weapon == W_BOW && (temp=pc->checkskill(sd,HT_BLITZBEAT))>0 &&
rnd()%1000 <= sstatus->luk*10/3+1 ) {
rate=(sd->status.job_level+9)/10;
skill->castend_damage_id(src,bl,HT_BLITZBEAT,(temp<rate)?temp:rate,tick,SD_LEVEL);
}
// Automatic trigger of Warg Strike [Jobbie]
- if( pc_iswug(sd) && (sd->status.weapon == W_BOW || sd->status.weapon == W_FIST) && (temp=iPc->checkskill(sd,RA_WUGSTRIKE)) > 0 && rnd()%1000 <= sstatus->luk*10/3+1 )
+ if( pc_iswug(sd) && (sd->status.weapon == W_BOW || sd->status.weapon == W_FIST) && (temp=pc->checkskill(sd,RA_WUGSTRIKE)) > 0 && rnd()%1000 <= sstatus->luk*10/3+1 )
skill->castend_damage_id(src,bl,RA_WUGSTRIKE,temp,tick,0);
// Gank
if(dstmd && sd->status.weapon != W_BOW &&
- (temp=iPc->checkskill(sd,RG_SNATCHER)) > 0 &&
- (temp*15 + 55) + iPc->checkskill(sd,TF_STEAL)*10 > rnd()%1000) {
- if(iPc->steal_item(sd,bl,iPc->checkskill(sd,TF_STEAL)))
+ (temp=pc->checkskill(sd,RG_SNATCHER)) > 0 &&
+ (temp*15 + 55) + pc->checkskill(sd,TF_STEAL)*10 > rnd()%1000) {
+ if(pc->steal_item(sd,bl,pc->checkskill(sd,TF_STEAL)))
clif->skill_nodamage(src,bl,TF_STEAL,temp,1);
else
clif->skill_fail(sd,RG_SNATCHER,USESKILL_FAIL_LEVEL,0);
@@ -874,7 +874,7 @@ int skill_additional_effect (struct block_list* src, struct block_list *bl, uint
break;
case SM_BASH:
- if( sd && skill_lv > 5 && iPc->checkskill(sd,SM_FATALBLOW)>0 ){
+ if( sd && skill_lv > 5 && pc->checkskill(sd,SM_FATALBLOW)>0 ){
//TODO: How much % per base level it actually is?
sc_start(bl,SC_STUN,(5*(skill_lv-5)+(int)sd->status.base_level/10),
skill_lv,skill->get_time2(SM_FATALBLOW,skill_lv));
@@ -887,7 +887,7 @@ int skill_additional_effect (struct block_list* src, struct block_list *bl, uint
case AS_VENOMKNIFE:
if (sd) //Poison chance must be that of Envenom. [Skotlex]
- skill_lv = iPc->checkskill(sd, TF_POISON);
+ skill_lv = pc->checkskill(sd, TF_POISON);
case TF_POISON:
case AS_SPLASHER:
if(!sc_start2(bl,SC_POISON,(4*skill_lv+10),skill_lv,src->id,skill->get_time2(skill_id,skill_lv))
@@ -1034,7 +1034,7 @@ int skill_additional_effect (struct block_list* src, struct block_list *bl, uint
case DC_UGLYDANCE:
rate = 5+5*skill_lv;
- if(sd && (temp=iPc->checkskill(sd,DC_DANCINGLESSON)))
+ if(sd && (temp=pc->checkskill(sd,DC_DANCINGLESSON)))
rate += 5+temp;
status_zap(bl, 0, rate);
break;
@@ -1194,7 +1194,7 @@ int skill_additional_effect (struct block_list* src, struct block_list *bl, uint
sc_start(bl,SC_CRITICALWOUND,100,skill_lv,skill->get_time2(skill_id,skill_lv));
break;
case RK_HUNDREDSPEAR:
- if( !sd || iPc->checkskill(sd,KN_SPEARBOOMERANG) == 0 )
+ if( !sd || pc->checkskill(sd,KN_SPEARBOOMERANG) == 0 )
break; // Spear Boomerang auto cast chance only works if you have mastered Spear Boomerang.
rate = 10 + 3 * skill_lv;
if( rnd()%100 < rate )
@@ -1231,11 +1231,11 @@ int skill_additional_effect (struct block_list* src, struct block_list *bl, uint
sc_start(bl,SC_FREEZE,100,skill_lv,skill->get_time(skill_id,skill_lv));
break;
case RA_WUGBITE:
- sc_start(bl, SC_BITE, (sd ? iPc->checkskill(sd,RA_TOOTHOFWUG)*2 : 0), skill_lv, (skill->get_time(skill_id,skill_lv) + (sd ? iPc->checkskill(sd,RA_TOOTHOFWUG)*500 : 0)) );
+ sc_start(bl, SC_BITE, (sd ? pc->checkskill(sd,RA_TOOTHOFWUG)*2 : 0), skill_lv, (skill->get_time(skill_id,skill_lv) + (sd ? pc->checkskill(sd,RA_TOOTHOFWUG)*500 : 0)) );
break;
case RA_SENSITIVEKEEN:
if( rnd()%100 < 8 * skill_lv )
- skill->castend_damage_id(src, bl, RA_WUGBITE, sd ? iPc->checkskill(sd, RA_WUGBITE):skill_lv, tick, SD_ANIMATION);
+ skill->castend_damage_id(src, bl, RA_WUGBITE, sd ? pc->checkskill(sd, RA_WUGBITE):skill_lv, tick, SD_ANIMATION);
break;
case RA_FIRINGTRAP:
case RA_ICEBOUNDTRAP:
@@ -1261,7 +1261,7 @@ int skill_additional_effect (struct block_list* src, struct block_list *bl, uint
case NC_POWERSWING:
sc_start(bl, SC_STUN, 5*skill_lv, skill_lv, skill->get_time(skill_id, skill_lv));
if( rnd()%100 < 5*skill_lv )
- skill->castend_damage_id(src, bl, NC_AXEBOOMERANG, iPc->checkskill(sd, NC_AXEBOOMERANG), tick, 1);
+ skill->castend_damage_id(src, bl, NC_AXEBOOMERANG, pc->checkskill(sd, NC_AXEBOOMERANG), tick, 1);
break;
case GC_WEAPONCRUSH:
skill->castend_nodamage_id(src,bl,skill_id,skill_lv,tick,BCT_ENEMY);
@@ -1270,14 +1270,14 @@ int skill_additional_effect (struct block_list* src, struct block_list *bl, uint
sc_start(bl, SC_STUN, 30 + 8 * skill_lv, skill_lv, skill->get_time(skill_id,skill_lv));
break;
case LG_PINPOINTATTACK:
- rate = 30 + (((5 * (sd?iPc->checkskill(sd,LG_PINPOINTATTACK):skill_lv)) + (sstatus->agi + status_get_lv(src))) / 10);
+ rate = 30 + (((5 * (sd?pc->checkskill(sd,LG_PINPOINTATTACK):skill_lv)) + (sstatus->agi + status_get_lv(src))) / 10);
switch( skill_lv ) {
case 1:
sc_start2(bl,SC_BLEEDING,rate,skill_lv,src->id,skill->get_time(skill_id,skill_lv));
break;
case 2:
if( dstsd && dstsd->spiritball && rnd()%100 < rate )
- iPc->delspiritball(dstsd, dstsd->spiritball, 0);
+ pc->delspiritball(dstsd, dstsd->spiritball, 0);
break;
default:
skill->break_equip(bl,(skill_lv == 3) ? EQP_SHIELD : (skill_lv == 4) ? EQP_ARMOR : EQP_WEAPON,rate * 100,BCT_ENEMY);
@@ -1609,7 +1609,7 @@ int skill_additional_effect (struct block_list* src, struct block_list *bl, uint
sd->autobonus[i].atk_type&attack_type&BF_RANGEMASK &&
sd->autobonus[i].atk_type&attack_type&BF_SKILLMASK))
continue; // one or more trigger conditions were not fulfilled
- iPc->exeautobonus(sd,&sd->autobonus[i]);
+ pc->exeautobonus(sd,&sd->autobonus[i]);
}
}
@@ -1722,7 +1722,7 @@ int skill_onskillusage(struct map_session_data *sd, struct block_list *bl, uint1
continue;
if( sd->autobonus3[i].atk_type != skill_id )
continue;
- iPc->exeautobonus(sd,&sd->autobonus3[i]);
+ pc->exeautobonus(sd,&sd->autobonus3[i]);
}
}
@@ -1807,9 +1807,9 @@ int skill_counter_additional_effect (struct block_list* src, struct block_list *
if(sd && skill_id && attack_type&BF_MAGIC && status_isdead(bl) &&
!(skill->get_inf(skill_id)&(INF_GROUND_SKILL|INF_SELF_SKILL)) &&
- (rate=iPc->checkskill(sd,HW_SOULDRAIN))>0
+ (rate=pc->checkskill(sd,HW_SOULDRAIN))>0
){ //Soul Drain should only work on targetted spells [Skotlex]
- if (pc_issit(sd)) iPc->setstand(sd); //Character stuck in attacking animation while 'sitting' fix. [Skotlex]
+ if (pc_issit(sd)) pc->setstand(sd); //Character stuck in attacking animation while 'sitting' fix. [Skotlex]
clif->skill_nodamage(src,bl,HW_SOULDRAIN,rate,1);
status_heal(src, 0, status_get_lv(bl)*(95+15*rate)/100, 2);
}
@@ -1943,7 +1943,7 @@ int skill_counter_additional_effect (struct block_list* src, struct block_list *
dstsd->autobonus2[i].atk_type&attack_type&BF_RANGEMASK &&
dstsd->autobonus2[i].atk_type&attack_type&BF_SKILLMASK))
continue; // one or more trigger conditions were not fulfilled
- iPc->exeautobonus(dstsd,&dstsd->autobonus2[i]);
+ pc->exeautobonus(dstsd,&dstsd->autobonus2[i]);
}
}
@@ -2036,7 +2036,7 @@ int skill_break_equip (struct block_list *bl, unsigned short where, int rate, in
}
if (flag) {
sd->status.inventory[j].attribute = 1;
- iPc->unequipitem(sd, j, 3);
+ pc->unequipitem(sd, j, 3);
}
}
clif->equiplist(sd);
@@ -2255,9 +2255,9 @@ int skill_attack (int attack_type, struct block_list* src, struct block_list *ds
//Spirit of Wizard blocks Kaite's reflection
if( type == 2 && sc && sc->data[SC_SPIRIT] && sc->data[SC_SPIRIT]->val2 == SL_WIZARD )
{ //Consume one Fragment per hit of the casted skill? [Skotlex]
- type = tsd?iPc->search_inventory (tsd, 7321):0;
+ type = tsd?pc->search_inventory (tsd, 7321):0;
if (type >= 0) {
- if ( tsd ) iPc->delitem(tsd, type, 1, 0, 1, LOG_TYPE_CONSUME);
+ if ( tsd ) pc->delitem(tsd, type, 1, 0, 1, LOG_TYPE_CONSUME);
dmg.damage = dmg.damage2 = 0;
dmg.dmg_lv = ATK_MISS;
sc->data[SC_SPIRIT]->val3 = skill_id;
@@ -2354,7 +2354,7 @@ int skill_attack (int attack_type, struct block_list* src, struct block_list *ds
case TK_STORMKICK:
case TK_DOWNKICK:
case TK_COUNTER:
- if (iPc->famerank(sd->status.char_id,MAPID_TAEKWON)) {//Extend combo time.
+ if (pc->famerank(sd->status.char_id,MAPID_TAEKWON)) {//Extend combo time.
sce->val1 = skill_id; //Update combo-skill
sce->val3 = skill_id;
if( sce->timer != INVALID_TIMER )
@@ -2371,27 +2371,27 @@ int skill_attack (int attack_type, struct block_list* src, struct block_list *ds
}
switch(skill_id) {
case MO_TRIPLEATTACK:
- if (iPc->checkskill(sd, MO_CHAINCOMBO) > 0 || iPc->checkskill(sd, SR_DRAGONCOMBO) > 0)
+ if (pc->checkskill(sd, MO_CHAINCOMBO) > 0 || pc->checkskill(sd, SR_DRAGONCOMBO) > 0)
flag=1;
break;
case MO_CHAINCOMBO:
- if(iPc->checkskill(sd, MO_COMBOFINISH) > 0 && sd->spiritball > 0)
+ if(pc->checkskill(sd, MO_COMBOFINISH) > 0 && sd->spiritball > 0)
flag=1;
break;
case MO_COMBOFINISH:
if (sd->status.party_id>0) //bonus from SG_FRIEND [Komurka]
- iParty->skill_check(sd, sd->status.party_id, MO_COMBOFINISH, skill_lv);
- if (iPc->checkskill(sd, CH_TIGERFIST) > 0 && sd->spiritball > 0)
+ party->skill_check(sd, sd->status.party_id, MO_COMBOFINISH, skill_lv);
+ if (pc->checkskill(sd, CH_TIGERFIST) > 0 && sd->spiritball > 0)
flag=1;
case CH_TIGERFIST:
- if (!flag && iPc->checkskill(sd, CH_CHAINCRUSH) > 0 && sd->spiritball > 1)
+ if (!flag && pc->checkskill(sd, CH_CHAINCRUSH) > 0 && sd->spiritball > 1)
flag=1;
case CH_CHAINCRUSH:
- if (!flag && iPc->checkskill(sd, MO_EXTREMITYFIST) > 0 && sd->spiritball > 0 && sd->sc.data[SC_EXPLOSIONSPIRITS])
+ if (!flag && pc->checkskill(sd, MO_EXTREMITYFIST) > 0 && sd->spiritball > 0 && sd->sc.data[SC_EXPLOSIONSPIRITS])
flag=1;
break;
case AC_DOUBLE:
- if( (tstatus->race == RC_BRUTE || tstatus->race == RC_INSECT) && iPc->checkskill(sd, HT_POWER))
+ if( (tstatus->race == RC_BRUTE || tstatus->race == RC_INSECT) && pc->checkskill(sd, HT_POWER))
{
//TODO: This code was taken from Triple Blows, is this even how it should be? [Skotlex]
sc_start2(src,SC_COMBO,100,HT_POWER,bl->id,2000);
@@ -2401,8 +2401,8 @@ int skill_attack (int attack_type, struct block_list* src, struct block_list *ds
case TK_COUNTER:
{ //bonus from SG_FRIEND [Komurka]
int level;
- if(sd->status.party_id>0 && (level = iPc->checkskill(sd,SG_FRIEND)))
- iParty->skill_check(sd, sd->status.party_id, TK_COUNTER,level);
+ if(sd->status.party_id>0 && (level = pc->checkskill(sd,SG_FRIEND)))
+ party->skill_check(sd, sd->status.party_id, TK_COUNTER,level);
}
break;
case SL_STIN:
@@ -2415,11 +2415,11 @@ int skill_attack (int attack_type, struct block_list* src, struct block_list *ds
sd->ud.attackabletime = sd->canuseitem_tick = sd->ud.canact_tick;
break;
case SR_DRAGONCOMBO:
- if( iPc->checkskill(sd, SR_FALLENEMPIRE) > 0 )
+ if( pc->checkskill(sd, SR_FALLENEMPIRE) > 0 )
flag = 1;
break;
case SR_FALLENEMPIRE:
- if( iPc->checkskill(sd, SR_TIGERCANNON) > 0 || iPc->checkskill(sd, SR_GATEOFHELL) > 0 )
+ if( pc->checkskill(sd, SR_TIGERCANNON) > 0 || pc->checkskill(sd, SR_GATEOFHELL) > 0 )
flag = 1;
break;
} //Switch End
@@ -2537,7 +2537,7 @@ int skill_attack (int attack_type, struct block_list* src, struct block_list *ds
iMap->freeblock_lock();
if(damage > 0 && dmg.flag&BF_SKILL && tsd
- && iPc->checkskill(tsd,RG_PLAGIARISM)
+ && pc->checkskill(tsd,RG_PLAGIARISM)
&& (!sc || !sc->data[SC_PRESERVE])
&& damage < tsd->battle_status.hp)
{ //Updated to not be able to copy skills if the blow will kill you. [Skotlex]
@@ -2610,7 +2610,7 @@ int skill_attack (int attack_type, struct block_list* src, struct block_list *ds
}
}
- if ((type = iPc->checkskill(tsd,RG_PLAGIARISM)) < lv)
+ if ((type = pc->checkskill(tsd,RG_PLAGIARISM)) < lv)
lv = type;
tsd->cloneskill_id = copy_skill;
@@ -2803,7 +2803,7 @@ int skill_attack (int attack_type, struct block_list* src, struct block_list *ds
}
break;
case WM_METALICSOUND:
- status_zap(bl, 0, damage*100/(100*(110-iPc->checkskill(sd,WM_LESSON)*10)));
+ status_zap(bl, 0, damage*100/(100*(110-pc->checkskill(sd,WM_LESSON)*10)));
break;
case SR_TIGERCANNON:
status_zap(bl, 0, damage/10); // 10% of damage dealt
@@ -3098,7 +3098,7 @@ int skill_check_condition_mercenary(struct block_list *bl, int skill_id, int lv,
{
index[i] = -1;
if( itemid[i] < 1 ) continue; // No item
- index[i] = iPc->search_inventory(sd, itemid[i]);
+ index[i] = pc->search_inventory(sd, itemid[i]);
if( index[i] < 0 || sd->status.inventory[index[i]].amount < amount[i] )
{
clif->skill_fail(sd, skill_id, USESKILL_FAIL_LEVEL, 0);
@@ -3109,7 +3109,7 @@ int skill_check_condition_mercenary(struct block_list *bl, int skill_id, int lv,
// Consume items
for( i = 0; i < ARRAYLENGTH(itemid); i++ )
{
- if( index[i] >= 0 ) iPc->delitem(sd, index[i], amount[i], 0, 1, LOG_TYPE_CONSUME);
+ if( index[i] >= 0 ) pc->delitem(sd, index[i], amount[i], 0, 1, LOG_TYPE_CONSUME);
}
if( type&2 )
@@ -3567,7 +3567,7 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint
case NC_VULCANARM:
case NC_COLDSLOWER:
case NC_ARMSCANNON:
- if (sd) iPc->overheat(sd,1);
+ if (sd) pc->overheat(sd,1);
case RK_WINDCUTTER:
skill->attack(BF_WEAPON,src,src,bl,skill_id,skill_lv,tick,flag|SD_ANIMATION);
break;
@@ -3628,7 +3628,7 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint
break;
case NC_FLAMELAUNCHER:
- if (sd) iPc->overheat(sd,1);
+ if (sd) pc->overheat(sd,1);
case SN_SHARPSHOOTING:
case MA_SHARPSHOOTING:
case NJ_KAMAITACHI:
@@ -4115,7 +4115,7 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint
case RK_STORMBLAST:
case RK_CRUSHSTRIKE:
if( sd ) {
- if( iPc->checkskill(sd,RK_RUNEMASTERY) >= ( skill_id == RK_CRUSHSTRIKE ? 7 : 3 ) )
+ if( pc->checkskill(sd,RK_RUNEMASTERY) >= ( skill_id == RK_CRUSHSTRIKE ? 7 : 3 ) )
skill->attack(BF_WEAPON,src,src,bl,skill_id,skill_lv,tick,flag);
else
clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0);
@@ -4396,7 +4396,7 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint
{
iMap->foreachinrange(skill->area_sub, bl, skill->get_splash(skill_id, skill_lv), splash_target(src), src, skill_id, skill_lv, tick, flag|BCT_ENEMY|SD_SPLASH|1, skill->castend_damage_id);
clif->skill_damage(src,src,tick, status_get_amotion(src), 0, -30000, 1, skill_id, skill_lv, 6);
- if( sd ) iPc->overheat(sd,1);
+ if( sd ) pc->overheat(sd,1);
}
break;
@@ -4806,7 +4806,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
heal_get_jobexp = heal_get_jobexp * battle_config.heal_exp / 100;
if (heal_get_jobexp <= 0)
heal_get_jobexp = 1;
- iPc->gainexp (sd, bl, 0, heal_get_jobexp, false);
+ pc->gainexp (sd, bl, 0, heal_get_jobexp, false);
}
}
break;
@@ -4828,8 +4828,8 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
}
skill_area_temp[0] = 5 - skill_area_temp[0]; // The actual penalty...
if (skill_area_temp[0] > 0 && !map[src->m].flag.noexppenalty) { //Apply penalty
- sd->status.base_exp -= min(sd->status.base_exp, iPc->nextbaseexp(sd) * skill_area_temp[0] * 2/1000); //0.2% penalty per each.
- sd->status.job_exp -= min(sd->status.job_exp, iPc->nextjobexp(sd) * skill_area_temp[0] * 2/1000);
+ sd->status.base_exp -= min(sd->status.base_exp, pc->nextbaseexp(sd) * skill_area_temp[0] * 2/1000); //0.2% penalty per each.
+ sd->status.job_exp -= min(sd->status.job_exp, pc->nextjobexp(sd) * skill_area_temp[0] * 2/1000);
clif->updatestatus(sd,SP_BASEEXP);
clif->updatestatus(sd,SP_JOBEXP);
}
@@ -4873,16 +4873,16 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
{
int exp = 0,jexp = 0;
int lv = dstsd->status.base_level - sd->status.base_level, jlv = dstsd->status.job_level - sd->status.job_level;
- if(lv > 0 && iPc->nextbaseexp(dstsd)) {
+ if(lv > 0 && pc->nextbaseexp(dstsd)) {
exp = (int)((double)dstsd->status.base_exp * (double)lv * (double)battle_config.resurrection_exp / 1000000.);
if (exp < 1) exp = 1;
}
- if(jlv > 0 && iPc->nextjobexp(dstsd)) {
+ if(jlv > 0 && pc->nextjobexp(dstsd)) {
jexp = (int)((double)dstsd->status.job_exp * (double)lv * (double)battle_config.resurrection_exp / 1000000.);
if (jexp < 1) jexp = 1;
}
if(exp > 0 || jexp > 0)
- iPc->gainexp (sd, bl, exp, jexp, false);
+ pc->gainexp (sd, bl, exp, jexp, false);
}
}
}
@@ -4994,7 +4994,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
break;
case SA_LEVELUP:
clif->skill_nodamage(src,bl,skill_id,skill_lv,1);
- if (sd && iPc->nextbaseexp(sd)) iPc->gainexp(sd, NULL, iPc->nextbaseexp(sd) * 10 / 100, 0, false);
+ if (sd && pc->nextbaseexp(sd)) pc->gainexp(sd, NULL, pc->nextbaseexp(sd) * 10 / 100, 0, false);
break;
case SA_INSTANTDEATH:
clif->skill_nodamage(src,bl,skill_id,skill_lv,1);
@@ -5042,7 +5042,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
break;
case SA_FORTUNE:
clif->skill_nodamage(src,bl,skill_id,skill_lv,1);
- if(sd) iPc->getzeny(sd,status_get_lv(bl)*100,LOG_TYPE_STEAL,NULL);
+ if(sd) pc->getzeny(sd,status_get_lv(bl)*100,LOG_TYPE_STEAL,NULL);
break;
case SA_TAMINGMONSTER:
clif->skill_nodamage(src,bl,skill_id,skill_lv,1);
@@ -5286,7 +5286,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
case SO_STRIKING:
if (sd) {
int bonus = 25 + 10 * skill_lv;
- bonus += (iPc->checkskill(sd, SA_FLAMELAUNCHER)+iPc->checkskill(sd, SA_FROSTWEAPON)+iPc->checkskill(sd, SA_LIGHTNINGLOADER)+iPc->checkskill(sd, SA_SEISMICWEAPON))*5;
+ bonus += (pc->checkskill(sd, SA_FLAMELAUNCHER)+pc->checkskill(sd, SA_FROSTWEAPON)+pc->checkskill(sd, SA_LIGHTNINGLOADER)+pc->checkskill(sd, SA_SEISMICWEAPON))*5;
clif->skill_nodamage( src, bl, skill_id, skill_lv,
battle->check_target(src,bl,BCT_PARTY) > 0 ?
sc_start2(bl, type, 100, skill_lv, bonus, skill->get_time(skill_id,skill_lv)) :
@@ -5503,7 +5503,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
if( sd->sc.data[SC_RAISINGDRAGON] )
limit += sd->sc.data[SC_RAISINGDRAGON]->val1;
clif->skill_nodamage(src,bl,skill_id,skill_lv,1);
- iPc->addspiritball(sd,skill->get_time(skill_id,skill_lv),limit);
+ pc->addspiritball(sd,skill->get_time(skill_id,skill_lv),limit);
}
break;
@@ -5514,13 +5514,13 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
limit += sd->sc.data[SC_RAISINGDRAGON]->val1;
clif->skill_nodamage(src,bl,skill_id,skill_lv,1);
for (i = 0; i < limit; i++)
- iPc->addspiritball(sd,skill->get_time(skill_id,skill_lv),limit);
+ pc->addspiritball(sd,skill->get_time(skill_id,skill_lv),limit);
}
break;
case MO_KITRANSLATION:
if(dstsd && (dstsd->class_&MAPID_BASEMASK)!=MAPID_GUNSLINGER) {
- iPc->addspiritball(dstsd,skill->get_time(skill_id,skill_lv),5);
+ pc->addspiritball(dstsd,skill->get_time(skill_id,skill_lv),5);
}
break;
@@ -5537,7 +5537,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
if (dstsd && dstsd->spiritball && (sd == dstsd || map_flag_vs(src->m)) && (dstsd->class_&MAPID_BASEMASK)!=MAPID_GUNSLINGER)
{ // split the if for readability, and included gunslingers in the check so that their coins cannot be removed [Reddozen]
i = dstsd->spiritball * 7;
- iPc->delspiritball(dstsd,dstsd->spiritball,0);
+ pc->delspiritball(dstsd,dstsd->spiritball,0);
} else if (dstmd && !(tstatus->mode&MD_BOSS) && rnd() % 100 < 20)
{ // check if target is a monster and not a Boss, for the 20% chance to absorb 2 SP per monster's level [Reddozen]
i = 2 * dstmd->level;
@@ -5840,7 +5840,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
case TF_STEAL:
if(sd) {
- if(iPc->steal_item(sd,bl,skill_lv))
+ if(pc->steal_item(sd,bl,skill_lv))
clif->skill_nodamage(src,bl,skill_id,skill_lv,1);
else
clif->skill_fail(sd,skill_id,USESKILL_FAIL,0);
@@ -5849,7 +5849,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
case RG_STEALCOIN:
if(sd) {
- if(iPc->steal_coin(sd,bl))
+ if(pc->steal_coin(sd,bl))
{
dstmd->state.provoke_flag = src->id;
mob_target(dstmd, src, skill->get_range2(src,skill_id,skill_lv));
@@ -6006,8 +6006,15 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
break;
case MC_IDENTIFY:
- if(sd)
+ if(sd) {
clif->item_identify_list(sd);
+ if( sd->menuskill_id != MC_IDENTIFY ) {/* failed, dont consume anything, return */
+ clif->skill_nodamage(src,bl,skill_id,skill_lv,1);
+ iMap->freeblock_unlock();
+ return 1;
+ }
+ status_zap(src,0,skill_db[skill->get_index(skill_id)].sp[skill_lv]); // consume sp only if succeeded
+ }
break;
// Weapon Refining [Celest]
@@ -6019,7 +6026,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
case MC_VENDING:
if(sd)
{ //Prevent vending of GMs with unnecessary Level to trade/drop. [Skotlex]
- if ( !iPc->can_give_items(sd) )
+ if ( !pc->can_give_items(sd) )
clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0);
else {
sd->state.prevend = 1;
@@ -6044,9 +6051,9 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
if( sd->state.autocast || ( (sd->skillitem == AL_TELEPORT || battle_config.skip_teleport_lv1_menu) && skill_lv == 1 ) || skill_lv == 3 )
{
if( skill_lv == 1 )
- iPc->randomwarp(sd,CLR_TELEPORT);
+ pc->randomwarp(sd,CLR_TELEPORT);
else
- iPc->setpos(sd,sd->status.save_point.map,sd->status.save_point.x,sd->status.save_point.y,CLR_TELEPORT);
+ pc->setpos(sd,sd->status.save_point.map,sd->status.save_point.x,sd->status.save_point.y,CLR_TELEPORT);
break;
}
@@ -6085,7 +6092,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
item_tmp.identify = 1;
tbl.id = 0;
clif->takeitem(&sd->bl,&tbl);
- eflag = iPc->additem(sd,&item_tmp,1,LOG_TYPE_PRODUCE);
+ eflag = pc->additem(sd,&item_tmp,1,LOG_TYPE_PRODUCE);
if(eflag) {
clif->additem(sd,0,0,eflag);
iMap->addflooritem(&item_tmp,1,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0);
@@ -6182,7 +6189,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
if( sd ) {
int x,bonus=100;
x = skill_lv%11 - 1;
- i = iPc->search_inventory(sd,skill_db[skill_id].itemid[x]);
+ i = pc->search_inventory(sd,skill_db[skill_id].itemid[x]);
if( i < 0 || skill_db[skill_id].itemid[x] <= 0 ) {
clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0);
iMap->freeblock_unlock();
@@ -6209,23 +6216,23 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
bonus += sd->status.base_level;
if( potion_per_hp > 0 || potion_per_sp > 0 ) {
hp = tstatus->max_hp * potion_per_hp / 100;
- hp = hp * (100 + iPc->checkskill(sd,AM_POTIONPITCHER)*10 + iPc->checkskill(sd,AM_LEARNINGPOTION)*5)*bonus/10000;
+ hp = hp * (100 + pc->checkskill(sd,AM_POTIONPITCHER)*10 + pc->checkskill(sd,AM_LEARNINGPOTION)*5)*bonus/10000;
if( dstsd ) {
sp = dstsd->status.max_sp * potion_per_sp / 100;
- sp = sp * (100 + iPc->checkskill(sd,AM_POTIONPITCHER)*10 + iPc->checkskill(sd,AM_LEARNINGPOTION)*5)*bonus/10000;
+ sp = sp * (100 + pc->checkskill(sd,AM_POTIONPITCHER)*10 + pc->checkskill(sd,AM_LEARNINGPOTION)*5)*bonus/10000;
}
} else {
if( potion_hp > 0 ) {
- hp = potion_hp * (100 + iPc->checkskill(sd,AM_POTIONPITCHER)*10 + iPc->checkskill(sd,AM_LEARNINGPOTION)*5)*bonus/10000;
+ hp = potion_hp * (100 + pc->checkskill(sd,AM_POTIONPITCHER)*10 + pc->checkskill(sd,AM_LEARNINGPOTION)*5)*bonus/10000;
hp = hp * (100 + (tstatus->vit<<1)) / 100;
if( dstsd )
- hp = hp * (100 + iPc->checkskill(dstsd,SM_RECOVERY)*10) / 100;
+ hp = hp * (100 + pc->checkskill(dstsd,SM_RECOVERY)*10) / 100;
}
if( potion_sp > 0 ) {
- sp = potion_sp * (100 + iPc->checkskill(sd,AM_POTIONPITCHER)*10 + iPc->checkskill(sd,AM_LEARNINGPOTION)*5)*bonus/10000;
+ sp = potion_sp * (100 + pc->checkskill(sd,AM_POTIONPITCHER)*10 + pc->checkskill(sd,AM_LEARNINGPOTION)*5)*bonus/10000;
sp = sp * (100 + (tstatus->int_<<1)) / 100;
if( dstsd )
- sp = sp * (100 + iPc->checkskill(dstsd,MG_SRECOVERY)*10) / 100;
+ sp = sp * (100 + pc->checkskill(dstsd,MG_SRECOVERY)*10) / 100;
}
}
@@ -6234,7 +6241,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
sp += sp * sd->itemgrouphealrate[IG_POTION] / 100;
}
- if( (i = iPc->skillheal_bonus(sd, skill_id)) ) {
+ if( (i = pc->skillheal_bonus(sd, skill_id)) ) {
hp += hp * i / 100;
sp += sp * i / 100;
}
@@ -6242,9 +6249,9 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
hp = (1 + rnd()%400) * (100 + skill_lv*10) / 100;
hp = hp * (100 + (tstatus->vit<<1)) / 100;
if( dstsd )
- hp = hp * (100 + iPc->checkskill(dstsd,SM_RECOVERY)*10) / 100;
+ hp = hp * (100 + pc->checkskill(dstsd,SM_RECOVERY)*10) / 100;
}
- if( dstsd && (i = iPc->skillheal2_bonus(dstsd, skill_id)) ) {
+ if( dstsd && (i = pc->skillheal2_bonus(dstsd, skill_id)) ) {
hp += hp * i / 100;
sp += sp * i / 100;
}
@@ -6281,7 +6288,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
{
unsigned int equip[] = {EQP_WEAPON, EQP_SHIELD, EQP_ARMOR, EQP_HEAD_TOP};
- if( sd && ( bl->type != BL_PC || ( dstsd && iPc->checkequip(dstsd,equip[skill_id - AM_CP_WEAPON]) < 0 ) ) ){
+ if( sd && ( bl->type != BL_PC || ( dstsd && pc->checkequip(dstsd,equip[skill_id - AM_CP_WEAPON]) < 0 ) ) ){
clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0);
iMap->freeblock_unlock(); // Don't consume item requirements
return 0;
@@ -6309,7 +6316,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
break;
case AM_TWILIGHT3:
if (sd) {
- int ebottle = iPc->search_inventory(sd,713);
+ int ebottle = pc->search_inventory(sd,713);
if( ebottle >= 0 )
ebottle = sd->status.inventory[ebottle].amount;
//check if you can produce all three, if not, then fail:
@@ -6766,8 +6773,8 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
// parent-baby skills
case WE_BABY:
if(sd){
- struct map_session_data *f_sd = iPc->get_father(sd);
- struct map_session_data *m_sd = iPc->get_mother(sd);
+ struct map_session_data *f_sd = pc->get_father(sd);
+ struct map_session_data *m_sd = pc->get_mother(sd);
// if neither was found
if(!f_sd && !m_sd){
clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0);
@@ -6819,7 +6826,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
memset(&item_tmp,0,sizeof(item_tmp));
item_tmp.nameid = skill_db[su->group->skill_id].itemid[i];
item_tmp.identify = 1;
- if( item_tmp.nameid && (flag=iPc->additem(sd,&item_tmp,skill_db[su->group->skill_id].amount[i],LOG_TYPE_OTHER)) )
+ if( item_tmp.nameid && (flag=pc->additem(sd,&item_tmp,skill_db[su->group->skill_id].amount[i],LOG_TYPE_OTHER)) )
{
clif->additem(sd,0,0,flag);
iMap->addflooritem(&item_tmp,skill_db[su->group->skill_id].amount[i],sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0);
@@ -6833,7 +6840,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
memset(&item_tmp,0,sizeof(item_tmp));
item_tmp.nameid = su->group->item_id?su->group->item_id:ITEMID_TRAP;
item_tmp.identify = 1;
- if( item_tmp.nameid && (flag=iPc->additem(sd,&item_tmp,1,LOG_TYPE_OTHER)) )
+ if( item_tmp.nameid && (flag=pc->additem(sd,&item_tmp,1,LOG_TYPE_OTHER)) )
{
clif->additem(sd,0,0,flag);
iMap->addflooritem(&item_tmp,1,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0);
@@ -6977,9 +6984,9 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
sp = sp * (100 + (tstatus->int_<<1))/100;
if (dstsd) {
if (hp)
- hp = hp * (100 + iPc->checkskill(dstsd,SM_RECOVERY)*10 + iPc->skillheal2_bonus(dstsd, skill_id))/100;
+ hp = hp * (100 + pc->checkskill(dstsd,SM_RECOVERY)*10 + pc->skillheal2_bonus(dstsd, skill_id))/100;
if (sp)
- sp = sp * (100 + iPc->checkskill(dstsd,MG_SRECOVERY)*10 + iPc->skillheal2_bonus(dstsd, skill_id))/100;
+ sp = sp * (100 + pc->checkskill(dstsd,MG_SRECOVERY)*10 + pc->skillheal2_bonus(dstsd, skill_id))/100;
}
if( tsc && tsc->count ) {
if (tsc->data[SC_CRITICALWOUND]) {
@@ -7009,7 +7016,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
int i, s = 0, skilltime = skill->get_time(skill_id,skill_lv);
for (i=0 ; i<4; i++) {
- if( bl->type != BL_PC || ( dstsd && iPc->checkequip(dstsd,equip[i]) < 0 ) )
+ if( bl->type != BL_PC || ( dstsd && pc->checkequip(dstsd,equip[i]) < 0 ) )
continue;
sc_start(bl,(sc_type)(SC_CP_WEAPON + i),100,skill_lv,skilltime);
s++;
@@ -7253,7 +7260,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
continue;
if(iMap->getcell(src->m,src->x+dx[j],src->y+dy[j],CELL_CHKNOREACH))
dx[j] = dy[j] = 0;
- iPc->setpos(dstsd, map_id2index(src->m), src->x+dx[j], src->y+dy[j], CLR_RESPAWN);
+ pc->setpos(dstsd, map_id2index(src->m), src->x+dx[j], src->y+dy[j], CLR_RESPAWN);
}
}
if (sd)
@@ -7274,7 +7281,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
case SG_HATE:
if (sd) {
clif->skill_nodamage(src,bl,skill_id,skill_lv,1);
- if (!iPc->set_hate_mob(sd, skill_lv-1, bl))
+ if (!pc->set_hate_mob(sd, skill_lv-1, bl))
clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0);
}
break;
@@ -7283,9 +7290,9 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
if(sd) {
clif->skill_nodamage(src,bl,skill_id,skill_lv,1);
if(rnd()%100 < (20+10*skill_lv))
- iPc->addspiritball(sd,skill->get_time(skill_id,skill_lv),10);
+ pc->addspiritball(sd,skill->get_time(skill_id,skill_lv),10);
else if(sd->spiritball > 0)
- iPc->delspiritball(sd,1,0);
+ pc->delspiritball(sd,1,0);
}
break;
@@ -7475,7 +7482,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
src,skill_id,skill_lv,tick,flag|BCT_ENEMY|1,skill->castend_damage_id);
break;
case RK_STONEHARDSKIN:
- if( sd && iPc->checkskill(sd,RK_RUNEMASTERY) >= 4 )
+ if( sd && pc->checkskill(sd,RK_RUNEMASTERY) >= 4 )
{
int heal = sstatus->hp / 4; // 25% HP
if( status_charge(bl,heal,0) )
@@ -7485,7 +7492,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
}
break;
case RK_REFRESH:
- if( sd && iPc->checkskill(sd,RK_RUNEMASTERY) >= 8 )
+ if( sd && pc->checkskill(sd,RK_RUNEMASTERY) >= 8 )
{
int heal = status_get_max_hp(bl) * 25 / 100;
clif->skill_nodamage(src,bl,skill_id,skill_lv,
@@ -7496,7 +7503,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
break;
case RK_MILLENNIUMSHIELD:
- if( sd && iPc->checkskill(sd,RK_RUNEMASTERY) >= 9 )
+ if( sd && pc->checkskill(sd,RK_RUNEMASTERY) >= 9 )
{
short shields = (rnd()%100<50) ? 4 : ((rnd()%100<80) ? 3 : 2);
sc_start4(bl,type,100,skill_lv,shields,1000,0,skill->get_time(skill_id,skill_lv));
@@ -7518,7 +7525,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
lv = 6;
else if( skill_id == RK_CRUSHSTRIKE )
lv = 7;
- if( iPc->checkskill(sd,RK_RUNEMASTERY) >= lv )
+ if( pc->checkskill(sd,RK_RUNEMASTERY) >= lv )
clif->skill_nodamage(src,bl,skill_id,skill_lv,sc_start(bl,type,100,skill_lv,skill->get_time(skill_id,skill_lv)));
}
break;
@@ -7526,10 +7533,10 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
case RK_FIGHTINGSPIRIT:
if( flag&1 ) {
if( src == bl )
- sc_start2(bl,type,100,skill_area_temp[5],10*(sd?iPc->checkskill(sd,RK_RUNEMASTERY):10),skill->get_time(skill_id,skill_lv));
+ sc_start2(bl,type,100,skill_area_temp[5],10*(sd?pc->checkskill(sd,RK_RUNEMASTERY):10),skill->get_time(skill_id,skill_lv));
else
sc_start(bl,type,100,skill_area_temp[5]/4,skill->get_time(skill_id,skill_lv));
- } else if( sd && iPc->checkskill(sd,RK_RUNEMASTERY) >= 5 ) {
+ } else if( sd && pc->checkskill(sd,RK_RUNEMASTERY) >= 5 ) {
if( sd->status.party_id ) {
i = party_foreachsamemap(skill->area_sub,sd,skill->get_splash(skill_id,skill_lv),src,skill_id,skill_lv,tick,BCT_PARTY,skill->area_sub_count);
skill_area_temp[5] = 7 * i; // ATK
@@ -7632,8 +7639,8 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
case AB_CLEMENTIA:
case AB_CANTO:
{
- int bless_lv = iPc->checkskill(sd,AL_BLESSING) + (sd->status.job_level / 10);
- int agi_lv = iPc->checkskill(sd,AL_INCAGI) + (sd->status.job_level / 10);
+ int bless_lv = pc->checkskill(sd,AL_BLESSING) + (sd->status.job_level / 10);
+ int agi_lv = pc->checkskill(sd,AL_INCAGI) + (sd->status.job_level / 10);
if( sd == NULL || sd->status.party_id == 0 || flag&1 )
clif->skill_nodamage(bl, bl, skill_id, skill_lv, sc_start(bl,type,100,
(skill_id == AB_CLEMENTIA)? bless_lv : (skill_id == AB_CANTO)? agi_lv : skill_lv, skill->get_time(skill_id,skill_lv)));
@@ -7652,7 +7659,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
case AB_CHEAL:
if( sd == NULL || sd->status.party_id == 0 || flag&1 ) {
if( sd && tstatus && !battle->check_undead(tstatus->race, tstatus->def_ele) ) {
- i = skill->calc_heal(src, bl, AL_HEAL, iPc->checkskill(sd, AL_HEAL), true);
+ i = skill->calc_heal(src, bl, AL_HEAL, pc->checkskill(sd, AL_HEAL), true);
if( (dstsd && pc_ismadogear(dstsd)) || status_isimmune(bl))
i = 0; // Should heal by 0 or won't do anything?? in iRO it breaks the healing to members.. [malufett]
@@ -7947,9 +7954,9 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
case RA_WUGMASTERY:
if( sd ) {
if( !pc_iswug(sd) )
- iPc->setoption(sd,sd->sc.option|OPTION_WUG);
+ pc->setoption(sd,sd->sc.option|OPTION_WUG);
else
- iPc->setoption(sd,sd->sc.option&~OPTION_WUG);
+ pc->setoption(sd,sd->sc.option&~OPTION_WUG);
clif->skill_nodamage(src,bl,skill_id,skill_lv,1);
}
break;
@@ -7957,11 +7964,11 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
case RA_WUGRIDER:
if( sd ) {
if( !pc_isridingwug(sd) && pc_iswug(sd) ) {
- iPc->setoption(sd,sd->sc.option&~OPTION_WUG);
- iPc->setoption(sd,sd->sc.option|OPTION_WUGRIDER);
+ pc->setoption(sd,sd->sc.option&~OPTION_WUG);
+ pc->setoption(sd,sd->sc.option|OPTION_WUGRIDER);
} else if( pc_isridingwug(sd) ) {
- iPc->setoption(sd,sd->sc.option&~OPTION_WUGRIDER);
- iPc->setoption(sd,sd->sc.option|OPTION_WUG);
+ pc->setoption(sd,sd->sc.option&~OPTION_WUGRIDER);
+ pc->setoption(sd,sd->sc.option|OPTION_WUG);
}
clif->skill_nodamage(src,bl,skill_id,skill_lv,1);
}
@@ -8001,7 +8008,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
case NC_SELFDESTRUCTION:
if( sd ) {
if( pc_ismadogear(sd) )
- iPc->setmadogear(sd, 0);
+ pc->setmadogear(sd, 0);
clif->skill_nodamage(src, bl, skill_id, skill_lv, 1);
skill->castend_damage_id(src, src, skill_id, skill_lv, tick, flag);
status_set_sp(src, 0, 0);
@@ -8012,7 +8019,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
clif->skill_damage(src, bl, tick, status_get_amotion(src), 0, -30000, 1, skill_id, skill_lv, 6);
clif->skill_nodamage(src, bl, skill_id, skill_lv,
sc_start(bl,type, 30 + 12 * skill_lv,skill_lv,skill->get_time(skill_id,skill_lv)));
- if( sd ) iPc->overheat(sd,1);
+ if( sd ) pc->overheat(sd,1);
break;
case NC_MAGNETICFIELD:
@@ -8020,7 +8027,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
{
iMap->foreachinrange(skill->area_sub,src,skill->get_splash(skill_id,skill_lv),splash_target(src),src,skill_id,skill_lv,tick,flag|BCT_ENEMY|SD_SPLASH|1,skill->castend_damage_id);;
clif->skill_damage(src,src,tick,status_get_amotion(src),0,-30000,1,skill_id,skill_lv,6);
- if (sd) iPc->overheat(sd,1);
+ if (sd) pc->overheat(sd,1);
}
clif->skill_nodamage(src,src,skill_id,skill_lv,i);
break;
@@ -8262,8 +8269,8 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
case LG_INSPIRATION:
if( sd && !map[sd->bl.m].flag.noexppenalty && sd->status.base_level != MAX_LEVEL ) {
- sd->status.base_exp -= min(sd->status.base_exp, iPc->nextbaseexp(sd) * 1 / 100); // 1% penalty.
- sd->status.job_exp -= min(sd->status.job_exp, iPc->nextjobexp(sd) * 1 / 100);
+ sd->status.base_exp -= min(sd->status.base_exp, pc->nextbaseexp(sd) * 1 / 100); // 1% penalty.
+ sd->status.job_exp -= min(sd->status.job_exp, pc->nextjobexp(sd) * 1 / 100);
clif->updatestatus(sd,SP_BASEEXP);
clif->updatestatus(sd,SP_JOBEXP);
}
@@ -8286,7 +8293,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
clif->skill_damage(src, bl, tick, status_get_amotion(src), 0, -30000, 1, skill_id, skill_lv, 6);
count = iMap->forcountinrange(skill->area_sub, src, skill->get_splash(skill_id,skill_lv), (sd)?sd->spiritball_old:15, // Assume 15 spiritballs in non-charactors
BL_CHAR, src, skill_id, skill_lv, tick, flag|BCT_ENEMY|1, skill->castend_nodamage_id);
- if( sd ) iPc->delspiritball(sd, count, 0);
+ if( sd ) pc->delspiritball(sd, count, 0);
clif->skill_nodamage(src, src, skill_id, skill_lv,
sc_start2(src, SC_CURSEDCIRCLE_ATKER, 100, skill_lv, count, skill->get_time(skill_id,skill_lv)));
}
@@ -8297,7 +8304,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
short max = 5 + skill_lv;
sc_start(bl, SC_EXPLOSIONSPIRITS, 100, skill_lv, skill->get_time(skill_id, skill_lv));
for( i = 0; i < max; i++ ) // Don't call more than max available spheres.
- iPc->addspiritball(sd, skill->get_time(skill_id, skill_lv), max);
+ pc->addspiritball(sd, skill->get_time(skill_id, skill_lv), max);
clif->skill_nodamage(src, bl, skill_id, skill_lv, sc_start(bl, type, 100, skill_lv,skill->get_time(skill_id, skill_lv)));
}
break;
@@ -8308,7 +8315,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
if( dstsd && dstsd->spiritball && (sd == dstsd || map_flag_vs(src->m)) && (dstsd->class_&MAPID_BASEMASK)!=MAPID_GUNSLINGER )
{
i = dstsd->spiritball; //1%sp per spiritball.
- iPc->delspiritball(dstsd, dstsd->spiritball, 0);
+ pc->delspiritball(dstsd, dstsd->spiritball, 0);
}
if( i ) status_percent_heal(src, 0, i);
clif->skill_nodamage(src, bl, skill_id, skill_lv, i ? 1:0);
@@ -8323,8 +8330,8 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
break;
if( sd && dstsd->spiritball <= 5 ) {
for(i = 0; i <= 5; i++) {
- iPc->addspiritball(dstsd, skill->get_time(MO_CALLSPIRITS, iPc->checkskill(sd,MO_CALLSPIRITS)), i);
- iPc->delspiritball(sd, sd->spiritball, 0);
+ pc->addspiritball(dstsd, skill->get_time(MO_CALLSPIRITS, pc->checkskill(sd,MO_CALLSPIRITS)), i);
+ pc->delspiritball(sd, sd->spiritball, 0);
}
}
clif->skill_nodamage(src, bl, skill_id, skill_lv, 1);
@@ -8378,7 +8385,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
case MI_RUSH_WINDMILL:
case MI_ECHOSONG:
if( sd == NULL || sd->status.party_id == 0 || (flag & 1) )
- sc_start4(bl,type,100,skill_lv,6*skill_lv,(sd?iPc->checkskill(sd,WM_LESSON):0),(sd?sd->status.job_level:0),skill->get_time(skill_id,skill_lv));
+ sc_start4(bl,type,100,skill_lv,6*skill_lv,(sd?pc->checkskill(sd,WM_LESSON):0),(sd?sd->status.job_level:0),skill->get_time(skill_id,skill_lv));
else if( sd ) { // Only shows effects on caster.
clif->skill_nodamage(src,bl,skill_id,skill_lv,1);
party_foreachsamemap(skill->area_sub, sd, skill->get_splash(skill_id, skill_lv), src, skill_id, skill_lv, tick, flag|BCT_PARTY|1, skill->castend_nodamage_id);
@@ -8403,7 +8410,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
tstatus->hp = heal;
tstatus->sp -= tstatus->sp * ( 120 - 20 * skill_lv ) / 100;
clif->skill_nodamage(src,bl,skill_id,skill_lv,1);
- iPc->revive((TBL_PC*)bl,heal,0);
+ pc->revive((TBL_PC*)bl,heal,0);
clif->resurrection(bl,1);
}
}
@@ -8424,9 +8431,9 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
case WM_GLOOMYDAY:
clif->skill_nodamage(src,bl,skill_id,skill_lv,1);
- if( dstsd && ( iPc->checkskill(dstsd,KN_BRANDISHSPEAR) || iPc->checkskill(dstsd,LK_SPIRALPIERCE) ||
- iPc->checkskill(dstsd,CR_SHIELDCHARGE) || iPc->checkskill(dstsd,CR_SHIELDBOOMERANG) ||
- iPc->checkskill(dstsd,PA_SHIELDCHAIN) || iPc->checkskill(dstsd,LG_SHIELDPRESS) ) )
+ if( dstsd && ( pc->checkskill(dstsd,KN_BRANDISHSPEAR) || pc->checkskill(dstsd,LK_SPIRALPIERCE) ||
+ pc->checkskill(dstsd,CR_SHIELDCHARGE) || pc->checkskill(dstsd,CR_SHIELDBOOMERANG) ||
+ pc->checkskill(dstsd,PA_SHIELDCHAIN) || pc->checkskill(dstsd,LG_SHIELDPRESS) ) )
{
sc_start(bl,SC_GLOOMYDAY_SK,100,skill_lv,skill->get_time(skill_id,skill_lv));
break;
@@ -8562,7 +8569,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
iMap->freeblock_unlock();
return 0;
}
- iPc->setpos(sd, mapindex, x, y, CLR_TELEPORT);
+ pc->setpos(sd, mapindex, x, y, CLR_TELEPORT);
}
break;
@@ -8590,7 +8597,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
case WM_LULLABY_DEEPSLEEP:
if( flag&1 ){
//[(Skill Level x 4) + (Voice Lessons Skill Level x 2) + (Caster�s Base Level / 15) + (Caster�s Job Level / 5)] %
- int rate = (4 * skill_lv) + ( (sd) ? iPc->checkskill(sd,WM_LESSON)*2 + sd->status.job_level/5 : 0 ) + status_get_lv(src) / 15;
+ int rate = (4 * skill_lv) + ( (sd) ? pc->checkskill(sd,WM_LESSON)*2 + sd->status.job_level/5 : 0 ) + status_get_lv(src) / 15;
if( bl != src )
sc_start(bl,type,rate,skill_lv,skill->get_time(skill_id,skill_lv));
}else {
@@ -8836,7 +8843,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
if(sd) {
int ttype = skill->get_ele(skill_id, skill_lv);
clif->skill_nodamage(src, bl, skill_id, skill_lv, 1);
- iPc->add_talisman(sd, skill->get_time(skill_id, skill_lv), 10, ttype);
+ pc->add_talisman(sd, skill->get_time(skill_id, skill_lv), 10, ttype);
}
break;
@@ -8853,7 +8860,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
iTimer->delete_timer(md->deletetimer, mob_timer_delete);
md->deletetimer = iTimer->add_timer (iTimer->gettick() + skill->get_time(skill_id, skill_lv), mob_timer_delete, md->bl.id, 0);
mob_spawn( md );
- iPc->setinvincibletimer(sd,500);// unlock target lock
+ pc->setinvincibletimer(sd,500);// unlock target lock
clif->skill_nodamage(src,bl,skill_id,skill_lv,1);
skill->blown(src,bl,skill->get_blewcount(skill_id,skill_lv),unit_getdir(bl),0);
}
@@ -9020,21 +9027,25 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
int summons[5] = {1004, 1303, 1303, 1994, 1994};
int qty[5] = {3 , 3 , 4 , 4 , 5};
struct mob_data *md;
- int i;
+ int i, dummy = 0;
+ i = iMap->foreachinmap(skill->check_condition_mob_master_sub ,hd->bl.m, BL_MOB, hd->bl.id, summons[skill_lv-1], skill_id, &dummy);
+ if(i >= qty[skill_lv-1])
+ break;
+
for(i=0; i<qty[skill_lv - 1]; i++){ //easy way
md = mob_once_spawn_sub(src, src->m, src->x, src->y, status_get_name(src), summons[skill_lv - 1], "", SZ_SMALL, AI_ATTACK);
if (md) {
- md->master_id = src->id;
+ md->master_id = src->id;
if (md->deletetimer != INVALID_TIMER)
iTimer->delete_timer(md->deletetimer, mob_timer_delete);
md->deletetimer = iTimer->add_timer(iTimer->gettick() + skill->get_time(skill_id, skill_lv), mob_timer_delete, md->bl.id, 0);
mob_spawn(md); //Now it is ready for spawning.
- sc_start4(&md->bl, SC_MODECHANGE, 100, 1, 0, MD_ASSIST, 0, 60000);
+ sc_start4(&md->bl, SC_MODECHANGE, 100, 1, 0, MD_CANATTACK|MD_AGGRESSIVE, 0, 60000);
}
}
- if (hd)
- skill->blockhomun_start(hd, skill_id, skill->get_cooldown(skill_id, skill_lv));
+ if (hd)
+ skill->blockhomun_start(hd, skill_id, skill->get_cooldown(skill_id, skill_lv));
}
break;
default:
@@ -9111,7 +9122,7 @@ int skill_castend_id(int tid, unsigned int tick, int id, intptr_t data)
return 0;
}
- if( sd && ud->skilltimer != INVALID_TIMER && (iPc->checkskill(sd,SA_FREECAST) > 0 || ud->skill_id == LG_EXEEDBREAK) )
+ if( sd && ud->skilltimer != INVALID_TIMER && (pc->checkskill(sd,SA_FREECAST) > 0 || ud->skill_id == LG_EXEEDBREAK) )
{// restore original walk speed
ud->skilltimer = INVALID_TIMER;
status_calc_bl(&sd->bl, SCB_SPEED);
@@ -9425,7 +9436,7 @@ int skill_castend_pos(int tid, unsigned int tick, int id, intptr_t data)
return 0;
}
- if( sd && ud->skilltimer != INVALID_TIMER && ( iPc->checkskill(sd,SA_FREECAST) > 0 || ud->skill_id == LG_EXEEDBREAK ) )
+ if( sd && ud->skilltimer != INVALID_TIMER && ( pc->checkskill(sd,SA_FREECAST) > 0 || ud->skill_id == LG_EXEEDBREAK ) )
{// restore original walk speed
ud->skilltimer = INVALID_TIMER;
status_calc_bl(&sd->bl, SCB_SPEED);
@@ -9887,7 +9898,7 @@ int skill_castend_pos2(struct block_list* src, int x, int y, uint16 skill_id, ui
case CR_SLIMPITCHER:
if (sd) {
int i = skill_lv%11 - 1;
- int j = iPc->search_inventory(sd,skill_db[skill_id].itemid[i]);
+ int j = pc->search_inventory(sd,skill_db[skill_id].itemid[i]);
if( j < 0 || skill_db[skill_id].itemid[i] <= 0 || sd->inventory_data[j] == NULL || sd->status.inventory[j].amount < skill_db[skill_id].amount[i] )
{
clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0);
@@ -9899,10 +9910,10 @@ int skill_castend_pos2(struct block_list* src, int x, int y, uint16 skill_id, ui
run_script(sd->inventory_data[j]->script,0,sd->bl.id,0);
potion_flag = 0;
//Apply skill bonuses
- i = iPc->checkskill(sd,CR_SLIMPITCHER)*10
- + iPc->checkskill(sd,AM_POTIONPITCHER)*10
- + iPc->checkskill(sd,AM_LEARNINGPOTION)*5
- + iPc->skillheal_bonus(sd, skill_id);
+ i = pc->checkskill(sd,CR_SLIMPITCHER)*10
+ + pc->checkskill(sd,AM_POTIONPITCHER)*10
+ + pc->checkskill(sd,AM_LEARNINGPOTION)*5
+ + pc->skillheal_bonus(sd, skill_id);
potion_hp = potion_hp * (100+i)/100;
potion_sp = potion_sp * (100+i)/100;
@@ -10104,7 +10115,7 @@ int skill_castend_pos2(struct block_list* src, int x, int y, uint16 skill_id, ui
skill->clear_unitgroup(src); // To remove previous skills - cannot used combined
if( (sg = skill->unitsetting(src,skill_id,skill_lv,src->x,src->y,0)) != NULL ) {
sc_start2(src,skill_id == NC_NEUTRALBARRIER ? SC_NEUTRALBARRIER_MASTER : SC_STEALTHFIELD_MASTER,100,skill_lv,sg->group_id,skill->get_time(skill_id,skill_lv));
- if( sd ) iPc->overheat(sd,1);
+ if( sd ) pc->overheat(sd,1);
}
break;
@@ -10154,7 +10165,7 @@ int skill_castend_pos2(struct block_list* src, int x, int y, uint16 skill_id, ui
status_change_end(src,SC_BANDING,INVALID_TIMER);
else if( (sg = skill->unitsetting(src,skill_id,skill_lv,src->x,src->y,0)) != NULL ) {
sc_start4(src,SC_BANDING,100,skill_lv,0,0,sg->group_id,skill->get_time(skill_id,skill_lv));
- if( sd ) iPc->banding(sd,skill_lv);
+ if( sd ) pc->banding(sd,skill_lv);
}
clif->skill_nodamage(src,src,skill_id,skill_lv,1);
break;
@@ -10211,7 +10222,7 @@ int skill_castend_pos2(struct block_list* src, int x, int y, uint16 skill_id, ui
iMap->foreachinarea(skill->area_sub, src->m,
ud->skillunit[i]->unit->bl.x - 3, ud->skillunit[i]->unit->bl.y - 3,
ud->skillunit[i]->unit->bl.x + 3, ud->skillunit[i]->unit->bl.y + 3, BL_CHAR,
- src, CR_ACIDDEMONSTRATION, sd ? iPc->checkskill(sd, CR_ACIDDEMONSTRATION) : skill_lv, tick, flag|BCT_ENEMY|1|SD_LEVEL, skill->castend_damage_id);
+ src, CR_ACIDDEMONSTRATION, sd ? pc->checkskill(sd, CR_ACIDDEMONSTRATION) : skill_lv, tick, flag|BCT_ENEMY|1|SD_LEVEL, skill->castend_damage_id);
skill->delunit(ud->skillunit[i]->unit);
break;
default:
@@ -10294,7 +10305,7 @@ int skill_castend_map (struct map_session_data *sd, uint16 skill_id, const char
sd->sc.data[SC_ROKISWEIL] ||
sd->sc.data[SC_AUTOCOUNTER] ||
sd->sc.data[SC_STEELBODY] ||
- (sd->sc.data[SC_DANCING] && skill_id < RK_ENCHANTBLADE && !iPc->checkskill(sd, WM_LESSON)) ||
+ (sd->sc.data[SC_DANCING] && skill_id < RK_ENCHANTBLADE && !pc->checkskill(sd, WM_LESSON)) ||
sd->sc.data[SC_BERSERK] || sd->sc.data[SC__BLOODYLUST] ||
sd->sc.data[SC_BASILICA] ||
sd->sc.data[SC_MARIONETTE] ||
@@ -10323,9 +10334,9 @@ int skill_castend_map (struct map_session_data *sd, uint16 skill_id, const char
switch(skill_id) {
case AL_TELEPORT:
if(strcmp(map,"Random")==0)
- iPc->randomwarp(sd,CLR_TELEPORT);
+ pc->randomwarp(sd,CLR_TELEPORT);
else if (sd->menuskill_val > 1) //Need lv2 to be able to warp here.
- iPc->setpos(sd,sd->status.save_point.map,sd->status.save_point.x,sd->status.save_point.y,CLR_TELEPORT);
+ pc->setpos(sd,sd->status.save_point.map,sd->status.save_point.x,sd->status.save_point.y,CLR_TELEPORT);
break;
case AL_WARP:
@@ -10360,7 +10371,7 @@ int skill_castend_map (struct map_session_data *sd, uint16 skill_id, const char
}
}
- lv = sd->skillitem==skill_id?sd->skillitemlv:iPc->checkskill(sd,skill_id);
+ lv = sd->skillitem==skill_id?sd->skillitemlv:pc->checkskill(sd,skill_id);
wx = sd->menuskill_val>>16;
wy = sd->menuskill_val&0xffff;
@@ -10680,8 +10691,8 @@ struct skill_unit_group* skill_unitsetting (struct block_list *src, uint16 skill
val1 = skill_lv +status->agi/10; // Flee increase
val2 = ((skill_lv+1)/2)+status->luk/10; // Perfect dodge increase
if(sd){
- val1 += iPc->checkskill(sd,BA_MUSICALLESSON);
- val2 += iPc->checkskill(sd,BA_MUSICALLESSON);
+ val1 += pc->checkskill(sd,BA_MUSICALLESSON);
+ val2 += pc->checkskill(sd,BA_MUSICALLESSON);
}
break;
case DC_HUMMING:
@@ -10690,47 +10701,47 @@ struct skill_unit_group* skill_unitsetting (struct block_list *src, uint16 skill
val1 *= 2;
#endif
if(sd)
- val1 += iPc->checkskill(sd,DC_DANCINGLESSON);
+ val1 += pc->checkskill(sd,DC_DANCINGLESSON);
break;
case BA_POEMBRAGI:
val1 = 3*skill_lv+status->dex/10; // Casting time reduction
//For some reason at level 10 the base delay reduction is 50%.
val2 = (skill_lv<10?3*skill_lv:50)+status->int_/5; // After-cast delay reduction
if(sd){
- val1 += 2*iPc->checkskill(sd,BA_MUSICALLESSON);
- val2 += 2*iPc->checkskill(sd,BA_MUSICALLESSON);
+ val1 += 2*pc->checkskill(sd,BA_MUSICALLESSON);
+ val2 += 2*pc->checkskill(sd,BA_MUSICALLESSON);
}
break;
case DC_DONTFORGETME:
val1 = status->dex/10 + 3*skill_lv + 5; // ASPD decrease
val2 = status->agi/10 + 3*skill_lv + 5; // Movement speed adjustment.
if(sd){
- val1 += iPc->checkskill(sd,DC_DANCINGLESSON);
- val2 += iPc->checkskill(sd,DC_DANCINGLESSON);
+ val1 += pc->checkskill(sd,DC_DANCINGLESSON);
+ val2 += pc->checkskill(sd,DC_DANCINGLESSON);
}
break;
case BA_APPLEIDUN:
val1 = 5+2*skill_lv+status->vit/10; // MaxHP percent increase
if(sd)
- val1 += iPc->checkskill(sd,BA_MUSICALLESSON);
+ val1 += pc->checkskill(sd,BA_MUSICALLESSON);
break;
case DC_SERVICEFORYOU:
val1 = 15+skill_lv+(status->int_/10); // MaxSP percent increase TO-DO: this INT bonus value is guessed
val2 = 20+3*skill_lv+(status->int_/10); // SP cost reduction
if(sd){
- val1 += iPc->checkskill(sd,DC_DANCINGLESSON); //TO-DO This bonus value is guessed
- val2 += iPc->checkskill(sd,DC_DANCINGLESSON); //TO-DO Should be half this value
+ val1 += pc->checkskill(sd,DC_DANCINGLESSON); //TO-DO This bonus value is guessed
+ val2 += pc->checkskill(sd,DC_DANCINGLESSON); //TO-DO Should be half this value
}
break;
case BA_ASSASSINCROSS:
val1 = 100+(10*skill_lv)+(status->agi/10); // ASPD increase
if(sd)
- val1 += 5*iPc->checkskill(sd,BA_MUSICALLESSON);
+ val1 += 5*pc->checkskill(sd,BA_MUSICALLESSON);
break;
case DC_FORTUNEKISS:
val1 = 10+skill_lv+(status->luk/10); // Critical increase
if(sd)
- val1 += iPc->checkskill(sd,DC_DANCINGLESSON);
+ val1 += pc->checkskill(sd,DC_DANCINGLESSON);
val1*=10; //Because every 10 crit is an actual cri point.
break;
case BD_DRUMBATTLEFIELD:
@@ -10848,7 +10859,7 @@ struct skill_unit_group* skill_unitsetting (struct block_list *src, uint16 skill
val2 = i; // aura type
limit += val1 * 1000;
subunt = i - 1;
- iPc->del_talisman(sd, sd->talisman[i], i);
+ pc->del_talisman(sd, sd->talisman[i], i);
}
}
break;
@@ -11100,7 +11111,7 @@ int skill_unit_onplace (struct skill_unit *src, struct block_list *bl, unsigned
sg->val1 = (count<<16)|working;
- iPc->setpos(sd,m,x,y,CLR_TELEPORT);
+ pc->setpos(sd,m,x,y,CLR_TELEPORT);
}
} else if(bl->type == BL_MOB && battle_config.mob_warp&2) {
int16 m = iMap->mapindex2mapid(sg->val3);
@@ -11725,7 +11736,7 @@ int skill_unit_onplace_timer (struct skill_unit *src, struct block_list *bl, uns
case UNT_DIMENSIONDOOR:
if( tsd && !map[bl->m].flag.noteleport )
- iPc->randomwarp(tsd,3);
+ pc->randomwarp(tsd,3);
else if( bl->type == BL_MOB && battle_config.mob_warp&8 )
unit_warp(bl,-1,-1,-1,3);
break;
@@ -11782,7 +11793,7 @@ int skill_unit_onplace_timer (struct skill_unit *src, struct block_list *bl, uns
break;
case 3:
skill->attack(skill->get_type(CR_ACIDDEMONSTRATION), ss, &src->bl, bl,
- CR_ACIDDEMONSTRATION, sd ? iPc->checkskill(sd, CR_ACIDDEMONSTRATION) : sg->skill_lv, tick, 0);
+ CR_ACIDDEMONSTRATION, sd ? pc->checkskill(sd, CR_ACIDDEMONSTRATION) : sg->skill_lv, tick, 0);
break;
}
@@ -12238,7 +12249,7 @@ int skill_check_condition_char_sub (struct block_list *bl, va_list ap) {
return 0;
if (sd->status.sex != tsd->status.sex &&
(tsd->class_&MAPID_UPPERMASK) == MAPID_BARDDANCER &&
- (skill_lv = iPc->checkskill(tsd, skill_id)) > 0 &&
+ (skill_lv = pc->checkskill(tsd, skill_id)) > 0 &&
(tsd->weapontype1==W_MUSICAL || tsd->weapontype1==W_WHIP) &&
sd->status.party_id && tsd->status.party_id &&
sd->status.party_id == tsd->status.party_id &&
@@ -12329,10 +12340,8 @@ int skill_check_condition_mob_master_sub (struct block_list *bl, va_list ap) {
mob_class=va_arg(ap,int);
skill=va_arg(ap,int);
c=va_arg(ap,int *);
-
- if( md->master_id != src_id || md->special_state.ai != (unsigned)(skill == AM_SPHEREMINE?2:skill == KO_ZANZOU?4:3) )
+ if( md->master_id != src_id || md->special_state.ai != (unsigned)(skill == AM_SPHEREMINE?2:skill == KO_ZANZOU?4:skill == MH_SUMMON_LEGION?1:3) )
return 0; //Non alchemist summoned mobs have nothing to do here.
-
if(md->class_==mob_class)
(*c)++;
@@ -12417,7 +12426,7 @@ int skill_check_condition_castbegin(struct map_session_data* sd, uint16 skill_id
if( skill_id == WZ_EARTHSPIKE && sc && sc->data[SC_EARTHSCROLL] && rnd()%100 > sc->data[SC_EARTHSCROLL]->val2 ) // [marquis007]
; //Do not consume item.
else if( sd->status.inventory[i].expire_time == 0 )
- iPc->delitem(sd,i,1,0,0,LOG_TYPE_CONSUME); // Rental usable items are not consumed until expiration
+ pc->delitem(sd,i,1,0,0,LOG_TYPE_CONSUME); // Rental usable items are not consumed until expiration
}
return 1;
}
@@ -12595,7 +12604,7 @@ int skill_check_condition_castbegin(struct map_session_data* sd, uint16 skill_id
status_change_end(&sd->bl, SC_COMBO, INVALID_TIMER);
return 0;
}
- if(sc->data[SC_COMBO]->val1 != skill_id && !( sd && sd->status.base_level >= 90 && iPc->famerank(sd->status.char_id, MAPID_TAEKWON) )) { //Cancel combo wait.
+ if(sc->data[SC_COMBO]->val1 != skill_id && !( sd && sd->status.base_level >= 90 && pc->famerank(sd->status.char_id, MAPID_TAEKWON) )) { //Cancel combo wait.
unit_cancel_combo(&sd->bl);
return 0;
}
@@ -12662,8 +12671,8 @@ int skill_check_condition_castbegin(struct map_session_data* sd, uint16 skill_id
case PR_REDEMPTIO:
{
int exp;
- if( ((exp = iPc->nextbaseexp(sd)) > 0 && get_percentage(sd->status.base_exp, exp) < 1) ||
- ((exp = iPc->nextjobexp(sd)) > 0 && get_percentage(sd->status.job_exp, exp) < 1)) {
+ if( ((exp = pc->nextbaseexp(sd)) > 0 && get_percentage(sd->status.base_exp, exp) < 1) ||
+ ((exp = pc->nextjobexp(sd)) > 0 && get_percentage(sd->status.job_exp, exp) < 1)) {
clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); //Not enough exp.
return 0;
}
@@ -12671,7 +12680,7 @@ int skill_check_condition_castbegin(struct map_session_data* sd, uint16 skill_id
}
case AM_TWILIGHT2:
case AM_TWILIGHT3:
- if (!iParty->skill_check(sd, sd->status.party_id, skill_id, skill_lv))
+ if (!party->skill_check(sd, sd->status.party_id, skill_id, skill_lv))
{
clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0);
return 0;
@@ -12804,7 +12813,7 @@ int skill_check_condition_castbegin(struct map_session_data* sd, uint16 skill_id
* Warlock
**/
case WL_COMET:
- if( skill->check_pc_partner(sd,skill_id,&skill_lv,1,0) <= 0 && ((i = iPc->search_inventory(sd,require.itemid[0])) < 0 || sd->status.inventory[i].amount < require.amount[0]) )
+ if( skill->check_pc_partner(sd,skill_id,&skill_lv,1,0) <= 0 && ((i = pc->search_inventory(sd,require.itemid[0])) < 0 || sd->status.inventory[i].amount < require.amount[0]) )
{
//clif->skill_fail(sd,skill_id,USESKILL_FAIL_NEED_ITEM,require.amount[0],require.itemid[0]);
clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0);
@@ -13342,7 +13351,7 @@ int skill_check_condition_castend(struct map_session_data* sd, uint16 skill_id,
for( i = 0; i < MAX_SKILL_ITEM_REQUIRE; ++i ) {
if( !require.itemid[i] )
continue;
- index[i] = iPc->search_inventory(sd,require.itemid[i]);
+ index[i] = pc->search_inventory(sd,require.itemid[i]);
if( index[i] < 0 || sd->status.inventory[index[i]].amount < require.amount[i] ) {
if( require.itemid[i] == ITEMID_RED_GEMSTONE )
clif->skill_fail(sd,skill_id,USESKILL_FAIL_REDJAMSTONE,0);// red gemstone required
@@ -13359,23 +13368,31 @@ int skill_check_condition_castend(struct map_session_data* sd, uint16 skill_id,
// type&2: consume items (after skill was used)
// type&1: consume the others (before skill was used)
-int skill_consume_requirement( struct map_session_data *sd, uint16 skill_id, uint16 skill_lv, short type)
-{
+int skill_consume_requirement( struct map_session_data *sd, uint16 skill_id, uint16 skill_lv, short type) {
struct skill_condition req;
nullpo_ret(sd);
req = skill->get_requirement(sd,skill_id,skill_lv);
- if( type&1 )
- {
- if( skill_id == CG_TAROTCARD || sd->state.autocast )
- req.sp = 0; // TarotCard will consume sp in skill_cast_nodamage_id [Inkfish]
+ if( type&1 ) {
+
+ switch( skill_id ) {
+ case CG_TAROTCARD: // TarotCard will consume sp in skill_cast_nodamage_id [Inkfish]
+ case MC_IDENTIFY:
+ req.sp = 0;
+ break;
+ default:
+ if( sd->state.autocast )
+ req.sp = 0;
+ break;
+ }
+
if(req.hp || req.sp)
status_zap(&sd->bl, req.hp, req.sp);
if(req.spiritball > 0)
- iPc->delspiritball(sd,req.spiritball,0);
+ pc->delspiritball(sd,req.spiritball,0);
if(req.zeny > 0)
{
@@ -13383,7 +13400,7 @@ int skill_consume_requirement( struct map_session_data *sd, uint16 skill_id, uin
req.zeny = 0; //Zeny is reduced on skill->attack.
if( sd->status.zeny < req.zeny )
req.zeny = sd->status.zeny;
- iPc->payzeny(sd,req.zeny,LOG_TYPE_CONSUME,NULL);
+ pc->payzeny(sd,req.zeny,LOG_TYPE_CONSUME,NULL);
}
}
@@ -13425,8 +13442,8 @@ int skill_consume_requirement( struct map_session_data *sd, uint16 skill_id, uin
break;
}
- if( (n = iPc->search_inventory(sd,req.itemid[i])) >= 0 )
- iPc->delitem(sd,n,req.amount[i],0,1,LOG_TYPE_CONSUME);
+ if( (n = pc->search_inventory(sd,req.itemid[i])) >= 0 )
+ pc->delitem(sd,n,req.amount[i],0,1,LOG_TYPE_CONSUME);
}
}
@@ -13593,9 +13610,9 @@ struct skill_condition skill_get_requirement(struct map_session_data* sd, uint16
req.amount[i] = 1; // Hocus Pocus allways use at least 1 gem
}
}
- if( skill_id >= HT_SKIDTRAP && skill_id <= HT_TALKIEBOX && iPc->checkskill(sd, RA_RESEARCHTRAP) > 0){
+ if( skill_id >= HT_SKIDTRAP && skill_id <= HT_TALKIEBOX && pc->checkskill(sd, RA_RESEARCHTRAP) > 0){
int16 itIndex;
- if( (itIndex = iPc->search_inventory(sd,req.itemid[i])) < 0 || ( itIndex >= 0 && sd->status.inventory[itIndex].amount < req.amount[i] ) ){
+ if( (itIndex = pc->search_inventory(sd,req.itemid[i])) < 0 || ( itIndex >= 0 && sd->status.inventory[itIndex].amount < req.amount[i] ) ){
req.itemid[i] = ITEMID_TRAP_ALLOY;
req.amount[i] = 1;
}
@@ -13623,7 +13640,7 @@ struct skill_condition skill_get_requirement(struct map_session_data* sd, uint16
// Check for cost reductions due to skills & SCs
switch(skill_id) {
case MC_MAMMONITE:
- if(iPc->checkskill(sd,BS_UNFAIRLYTRICK)>0)
+ if(pc->checkskill(sd,BS_UNFAIRLYTRICK)>0)
req.zeny -= req.zeny*10/100;
break;
case AL_HOLYLIGHT:
@@ -13634,7 +13651,7 @@ struct skill_condition skill_get_requirement(struct map_session_data* sd, uint16
case SL_STUN:
case SL_STIN:
{
- int kaina_lv = iPc->checkskill(sd,SL_KAINA);
+ int kaina_lv = pc->checkskill(sd,SL_KAINA);
if(kaina_lv==0 || sd->status.base_level<70)
break;
@@ -13692,7 +13709,7 @@ struct skill_condition skill_get_requirement(struct map_session_data* sd, uint16
case SO_SUMMON_AQUA:
case SO_SUMMON_VENTUS:
case SO_SUMMON_TERA:
- req.sp -= req.sp * (5 + 5 * iPc->checkskill(sd,SO_EL_SYMPATHY)) / 100;
+ req.sp -= req.sp * (5 + 5 * pc->checkskill(sd,SO_EL_SYMPATHY)) / 100;
break;
case SO_PSYCHIC_WAVE:
if( sc && sc->data[SC_BLAST_OPTION] )
@@ -13866,7 +13883,7 @@ int skill_vfcastfix (struct block_list *bl, double time, uint16 skill_id, uint16
fixcast_r = max(fixcast_r, sc->data[SC__LAZINESS]->val2);
if( sc->data[SC_SECRAMENT] )
fixcast_r = max(fixcast_r, sc->data[SC_SECRAMENT]->val2);
- if( sd && ( skill_lv = iPc->checkskill(sd, WL_RADIUS) ) && skill_id >= WL_WHITEIMPRISON && skill_id <= WL_FREEZE_SP )
+ if( sd && ( skill_lv = pc->checkskill(sd, WL_RADIUS) ) && skill_id >= WL_WHITEIMPRISON && skill_id <= WL_FREEZE_SP )
fixcast_r = max(fixcast_r, 5 + skill_lv * 5);
// Fixed cast non percentage bonuses
if( sc->data[SC_MANDRAGORA] )
@@ -14187,7 +14204,7 @@ void skill_repairweapon (struct map_session_data *sd, int idx) {
material = materials [ target_sd->inventory_data[idx]->wlv - 1 ]; // Lv1/2/3/4 weapons consume 1 Iron Ore/Iron/Steel/Rough Oridecon
else
material = materials [2]; // Armors consume 1 Steel
- if ( iPc->search_inventory(sd,material) < 0 ) {
+ if ( pc->search_inventory(sd,material) < 0 ) {
clif->skill_fail(sd,sd->menuskill_id,USESKILL_FAIL_LEVEL,0);
return;
}
@@ -14198,7 +14215,7 @@ void skill_repairweapon (struct map_session_data *sd, int idx) {
clif->equiplist(target_sd);
- iPc->delitem(sd,iPc->search_inventory(sd,material),1,0,0,LOG_TYPE_CONSUME);
+ pc->delitem(sd,pc->search_inventory(sd,material),1,0,0,LOG_TYPE_CONSUME);
clif->item_repaireffect(sd,idx,0);
@@ -14244,7 +14261,7 @@ void skill_weaponrefine (struct map_session_data *sd, int idx)
if( item->refine >= sd->menuskill_val
|| item->refine >= 10 // if it's no longer refineable
|| ditem->flag.no_refine // if the item isn't refinable
- || (i = iPc->search_inventory(sd, material [ditem->wlv])) < 0 )
+ || (i = pc->search_inventory(sd, material [ditem->wlv])) < 0 )
{
clif->skill_fail(sd,sd->menuskill_id,USESKILL_FAIL_LEVEL,0);
return;
@@ -14253,20 +14270,20 @@ void skill_weaponrefine (struct map_session_data *sd, int idx)
per = status_get_refine_chance(ditem->wlv, (int)item->refine);
per += (((signed int)sd->status.job_level)-50)/2; //Updated per the new kro descriptions. [Skotlex]
- iPc->delitem(sd, i, 1, 0, 0, LOG_TYPE_OTHER);
+ pc->delitem(sd, i, 1, 0, 0, LOG_TYPE_OTHER);
if (per > rnd() % 100) {
logs->pick_pc(sd, LOG_TYPE_OTHER, -1, item, ditem);
item->refine++;
logs->pick_pc(sd, LOG_TYPE_OTHER, 1, item, ditem);
if(item->equip) {
ep = item->equip;
- iPc->unequipitem(sd,idx,3);
+ pc->unequipitem(sd,idx,3);
}
clif->refine(sd->fd,0,idx,item->refine);
clif->delitem(sd,idx,1,3);
clif->additem(sd,idx,1,0);
if (ep)
- iPc->equipitem(sd,idx,ep);
+ pc->equipitem(sd,idx,ep);
clif->misceffect(&sd->bl,3);
if(item->refine == 10 &&
item->card[0] == CARD0_FORGE &&
@@ -14274,22 +14291,22 @@ void skill_weaponrefine (struct map_session_data *sd, int idx)
{ // Fame point system [DracoRPG]
switch(ditem->wlv){
case 1:
- iPc->addfame(sd,1); // Success to refine to +10 a lv1 weapon you forged = +1 fame point
+ pc->addfame(sd,1); // Success to refine to +10 a lv1 weapon you forged = +1 fame point
break;
case 2:
- iPc->addfame(sd,25); // Success to refine to +10 a lv2 weapon you forged = +25 fame point
+ pc->addfame(sd,25); // Success to refine to +10 a lv2 weapon you forged = +25 fame point
break;
case 3:
- iPc->addfame(sd,1000); // Success to refine to +10 a lv3 weapon you forged = +1000 fame point
+ pc->addfame(sd,1000); // Success to refine to +10 a lv3 weapon you forged = +1000 fame point
break;
}
}
} else {
item->refine = 0;
if(item->equip)
- iPc->unequipitem(sd,idx,3);
+ pc->unequipitem(sd,idx,3);
clif->refine(sd->fd,1,idx,item->refine);
- iPc->delitem(sd,idx,1,0,2, LOG_TYPE_OTHER);
+ pc->delitem(sd,idx,1,0,2, LOG_TYPE_OTHER);
clif->misceffect(&sd->bl,2);
clif->emotion(&sd->bl, E_OMG);
}
@@ -14308,7 +14325,7 @@ int skill_autospell (struct map_session_data *sd, uint16 skill_id)
nullpo_ret(sd);
skill_lv = sd->menuskill_val;
- lv=iPc->checkskill(sd,skill_id);
+ lv=pc->checkskill(sd,skill_id);
if(!skill_lv || !lv) return 0; // Player must learn the skill before doing auto-spell [Lance]
@@ -14351,10 +14368,10 @@ int skill_sit_count (struct block_list *bl, va_list ap) {
if(!pc_issit(sd))
return 0;
- if(type&1 && iPc->checkskill(sd,RG_GANGSTER) > 0)
+ if(type&1 && pc->checkskill(sd,RG_GANGSTER) > 0)
return 1;
- if(type&2 && (iPc->checkskill(sd,TK_HPTIME) > 0 || iPc->checkskill(sd,TK_SPTIME) > 0))
+ if(type&2 && (pc->checkskill(sd,TK_HPTIME) > 0 || pc->checkskill(sd,TK_SPTIME) > 0))
return 1;
return 0;
@@ -14369,10 +14386,10 @@ int skill_sit_in (struct block_list *bl, va_list ap) {
if(!pc_issit(sd))
return 0;
- if(type&1 && iPc->checkskill(sd,RG_GANGSTER) > 0)
+ if(type&1 && pc->checkskill(sd,RG_GANGSTER) > 0)
sd->state.gangsterparadise=1;
- if(type&2 && (iPc->checkskill(sd,TK_HPTIME) > 0 || iPc->checkskill(sd,TK_SPTIME) > 0 )) {
+ if(type&2 && (pc->checkskill(sd,TK_HPTIME) > 0 || pc->checkskill(sd,TK_SPTIME) > 0 )) {
sd->state.rest=1;
status_calc_regen(bl, &sd->battle_status, &sd->regen);
status_calc_regen_rate(bl, &sd->regen, &sd->sc);
@@ -14402,15 +14419,15 @@ int skill_sit (struct map_session_data *sd, int type)
nullpo_ret(sd);
- if((lv = iPc->checkskill(sd,RG_GANGSTER)) > 0) {
+ if((lv = pc->checkskill(sd,RG_GANGSTER)) > 0) {
flag|=1;
range = skill->get_splash(RG_GANGSTER, lv);
}
- if((lv = iPc->checkskill(sd,TK_HPTIME)) > 0) {
+ if((lv = pc->checkskill(sd,TK_HPTIME)) > 0) {
flag|=2;
range = skill->get_splash(TK_HPTIME, lv);
}
- else if ((lv = iPc->checkskill(sd,TK_SPTIME)) > 0) {
+ else if ((lv = pc->checkskill(sd,TK_SPTIME)) > 0) {
flag|=2;
range = skill->get_splash(TK_SPTIME, lv);
}
@@ -14613,7 +14630,7 @@ int skill_greed (struct block_list *bl, va_list ap) {
nullpo_ret(src = va_arg(ap, struct block_list *));
if(src->type == BL_PC && (sd=(struct map_session_data *)src) && bl->type==BL_ITEM && (fitem=(struct flooritem_data *)bl))
- iPc->takeitem(sd, fitem);
+ pc->takeitem(sd, fitem);
return 0;
}
@@ -15373,7 +15390,7 @@ int skill_unit_timer_sub_onplace (struct block_list* bl, va_list ap) {
* @see DBApply
*/
int skill_unit_timer_sub(DBKey key, DBData *data, va_list ap) {
- struct skill_unit* unit = iDB->data2ptr(data);
+ struct skill_unit* unit = DB->data2ptr(data);
struct skill_unit_group* group = unit->group;
unsigned int tick = va_arg(ap,unsigned int);
bool dissonance;
@@ -15461,13 +15478,13 @@ int skill_unit_timer_sub(DBKey key, DBData *data, va_list ap) {
sd = iMap->charid2sd(group->val1);
group->val1 = 0;
if (sd && !map[sd->bl.m].flag.nowarp)
- iPc->setpos(sd,map_id2index(unit->bl.m),unit->bl.x,unit->bl.y,CLR_TELEPORT);
+ pc->setpos(sd,map_id2index(unit->bl.m),unit->bl.x,unit->bl.y,CLR_TELEPORT);
}
if(group->val2) {
sd = iMap->charid2sd(group->val2);
group->val2 = 0;
if (sd && !map[sd->bl.m].flag.nowarp)
- iPc->setpos(sd,map_id2index(unit->bl.m),unit->bl.x,unit->bl.y,CLR_TELEPORT);
+ pc->setpos(sd,map_id2index(unit->bl.m),unit->bl.x,unit->bl.y,CLR_TELEPORT);
}
skill->delunit(unit);
}
@@ -15829,7 +15846,7 @@ int skill_can_produce_mix (struct map_session_data *sd, int nameid, int trigger,
for(i=0;i<MAX_SKILL_PRODUCE_DB;i++){
if(skill_produce_db[i].nameid == nameid ){
if((j=skill_produce_db[i].req_skill)>0 &&
- iPc->checkskill(sd,j) < skill_produce_db[i].req_skill_lv)
+ pc->checkskill(sd,j) < skill_produce_db[i].req_skill_lv)
continue; // must iterate again to check other skills that produce it. [malufett]
if( j > 0 && sd->menuskill_id > 0 && sd->menuskill_id != j )
continue; // special case
@@ -15840,7 +15857,7 @@ int skill_can_produce_mix (struct map_session_data *sd, int nameid, int trigger,
if( i >= MAX_SKILL_PRODUCE_DB )
return 0;
- if( iPc->checkadditem(sd, nameid, qty) == ADDITEM_OVERAMOUNT )
+ if( pc->checkadditem(sd, nameid, qty) == ADDITEM_OVERAMOUNT )
{// cannot carry the produced stuff
return 0;
}
@@ -15863,7 +15880,7 @@ int skill_can_produce_mix (struct map_session_data *sd, int nameid, int trigger,
if( (id=skill_produce_db[i].mat_id[j]) <= 0 )
continue;
if(skill_produce_db[i].mat_amount[j] <= 0) {
- if(iPc->search_inventory(sd,id) < 0)
+ if(pc->search_inventory(sd,id) < 0)
return 0;
}
else {
@@ -15915,22 +15932,22 @@ int skill_produce_mix (struct map_session_data *sd, uint16 skill_id, int nameid,
int j;
if( slot[i]<=0 )
continue;
- j = iPc->search_inventory(sd,slot[i]);
+ j = pc->search_inventory(sd,slot[i]);
if(j < 0)
continue;
if(slot[i]==1000){ /* Star Crumb */
- iPc->delitem(sd,j,1,1,0,LOG_TYPE_PRODUCE);
+ pc->delitem(sd,j,1,1,0,LOG_TYPE_PRODUCE);
sc++;
}
if(slot[i]>=994 && slot[i]<=997 && ele==0){ /* Flame Heart . . . Great Nature */
static const int ele_table[4]={3,1,4,2};
- iPc->delitem(sd,j,1,1,0,LOG_TYPE_PRODUCE);
+ pc->delitem(sd,j,1,1,0,LOG_TYPE_PRODUCE);
ele=ele_table[slot[i]-994];
}
}
if( skill_id == RK_RUNEMASTERY ) {
- int temp_qty, skill_lv = iPc->checkskill(sd,skill_id);
+ int temp_qty, skill_lv = pc->checkskill(sd,skill_id);
data = itemdb_search(nameid);
if( skill_lv == 10 ) temp_qty = 1 + rnd()%3;
@@ -15965,12 +15982,12 @@ int skill_produce_mix (struct map_session_data *sd, uint16 skill_id, int nameid,
x=( skill_id == RK_RUNEMASTERY ? 1 : qty)*skill_produce_db[idx].mat_amount[i];
do{
int y=0;
- j = iPc->search_inventory(sd,id);
+ j = pc->search_inventory(sd,id);
if(j >= 0){
y = sd->status.inventory[j].amount;
if(y>x)y=x;
- iPc->delitem(sd,j,y,0,0,LOG_TYPE_PRODUCE);
+ pc->delitem(sd,j,y,0,0,LOG_TYPE_PRODUCE);
} else
ShowError("skill_produce_mix: material item error\n");
@@ -15986,7 +16003,7 @@ int skill_produce_mix (struct map_session_data *sd, uint16 skill_id, int nameid,
case BS_STEEL:
case BS_ENCHANTEDSTONE:
// Ores & Metals Refining - skill bonuses are straight from kRO website [DracoRPG]
- i = iPc->checkskill(sd,skill_id);
+ i = pc->checkskill(sd,skill_id);
make_per = sd->status.job_level*20 + status->dex*10 + status->luk*10; //Base chance
switch(nameid){
case 998: // Iron
@@ -16017,8 +16034,8 @@ int skill_produce_mix (struct map_session_data *sd, uint16 skill_id, int nameid,
case AM_TWILIGHT1:
case AM_TWILIGHT2:
case AM_TWILIGHT3:
- make_per = iPc->checkskill(sd,AM_LEARNINGPOTION)*50
- + iPc->checkskill(sd,AM_PHARMACY)*300 + sd->status.job_level*20
+ make_per = pc->checkskill(sd,AM_LEARNINGPOTION)*50
+ + pc->checkskill(sd,AM_PHARMACY)*300 + sd->status.job_level*20
+ (status->int_/2)*10 + status->dex*10+status->luk*10;
if(homun_alive(sd->hd)) {//Player got a homun
int skill;
@@ -16066,7 +16083,7 @@ int skill_produce_mix (struct map_session_data *sd, uint16 skill_id, int nameid,
**/
case RK_RUNEMASTERY:
{
- int A = 100 * (51 + 2 * iPc->checkskill(sd, skill_id));
+ int A = 100 * (51 + 2 * pc->checkskill(sd, skill_id));
int B = 100 * status->dex / 30 + 10 * (status->luk + sd->status.job_level);
int C = 100 * cap_value(sd->itemid,0,100); //itemid depend on makerune()
int D = 0;
@@ -16098,8 +16115,8 @@ int skill_produce_mix (struct map_session_data *sd, uint16 skill_id, int nameid,
* Guilotine Cross
**/
case GC_CREATENEWPOISON:
- make_per = 3000 + 500 * iPc->checkskill(sd,GC_RESEARCHNEWPOISON);
- qty = 1+rnd()%iPc->checkskill(sd,GC_RESEARCHNEWPOISON);
+ make_per = 3000 + 500 * pc->checkskill(sd,GC_RESEARCHNEWPOISON);
+ qty = 1+rnd()%pc->checkskill(sd,GC_RESEARCHNEWPOISON);
break;
case GN_CHANGEMATERIAL:
for(i=0; i<MAX_SKILL_PRODUCE_DB; i++)
@@ -16115,7 +16132,7 @@ int skill_produce_mix (struct map_session_data *sd, uint16 skill_id, int nameid,
difficulty = (620 - 20 * skill_lv);// (620 - 20 * Skill Level)
make_per = status->int_ + status->dex/2 + status->luk + sd->status.job_level + (30+rnd()%120) + // (Caster?s INT) + (Caster?s DEX / 2) + (Caster?s LUK) + (Caster?s Job Level) + Random number between (30 ~ 150) +
- (sd->status.base_level-100) + iPc->checkskill(sd, AM_LEARNINGPOTION) + iPc->checkskill(sd, CR_FULLPROTECTION)*(4+rnd()%6); // (Caster?s Base Level - 100) + (Potion Research x 5) + (Full Chemical Protection Skill Level) x (Random number between 4 ~ 10)
+ (sd->status.base_level-100) + pc->checkskill(sd, AM_LEARNINGPOTION) + pc->checkskill(sd, CR_FULLPROTECTION)*(4+rnd()%6); // (Caster?s Base Level - 100) + (Potion Research x 5) + (Full Chemical Protection Skill Level) x (Random number between 4 ~ 10)
switch(nameid){// difficulty factor
case 12422: case 12425:
@@ -16217,13 +16234,13 @@ int skill_produce_mix (struct map_session_data *sd, uint16 skill_id, int nameid,
}
} else { // Weapon Forging - skill bonuses are straight from kRO website, other things from a jRO calculator [DracoRPG]
make_per = 5000 + sd->status.job_level*20 + status->dex*10 + status->luk*10; // Base
- make_per += iPc->checkskill(sd,skill_id)*500; // Smithing skills bonus: +5/+10/+15
- make_per += iPc->checkskill(sd,BS_WEAPONRESEARCH)*100 +((wlv >= 3)? iPc->checkskill(sd,BS_ORIDEOCON)*100:0); // Weaponry Research bonus: +1/+2/+3/+4/+5/+6/+7/+8/+9/+10, Oridecon Research bonus (custom): +1/+2/+3/+4/+5
+ make_per += pc->checkskill(sd,skill_id)*500; // Smithing skills bonus: +5/+10/+15
+ make_per += pc->checkskill(sd,BS_WEAPONRESEARCH)*100 +((wlv >= 3)? pc->checkskill(sd,BS_ORIDEOCON)*100:0); // Weaponry Research bonus: +1/+2/+3/+4/+5/+6/+7/+8/+9/+10, Oridecon Research bonus (custom): +1/+2/+3/+4/+5
make_per -= (ele?2000:0) + sc*1500 + (wlv>1?wlv*1000:0); // Element Stone: -20%, Star Crumb: -15% each, Weapon level malus: -0/-20/-30
- if(iPc->search_inventory(sd,989) > 0) make_per+= 1000; // Emperium Anvil: +10
- else if(iPc->search_inventory(sd,988) > 0) make_per+= 500; // Golden Anvil: +5
- else if(iPc->search_inventory(sd,987) > 0) make_per+= 300; // Oridecon Anvil: +3
- else if(iPc->search_inventory(sd,986) > 0) make_per+= 0; // Anvil: +0?
+ if(pc->search_inventory(sd,989) > 0) make_per+= 1000; // Emperium Anvil: +10
+ else if(pc->search_inventory(sd,988) > 0) make_per+= 500; // Golden Anvil: +5
+ else if(pc->search_inventory(sd,987) > 0) make_per+= 300; // Oridecon Anvil: +3
+ else if(pc->search_inventory(sd,986) > 0) make_per+= 0; // Anvil: +0?
if(battle_config.wp_rate != 100)
make_per = make_per * battle_config.wp_rate / 100;
}
@@ -16293,7 +16310,7 @@ int skill_produce_mix (struct map_session_data *sd, uint16 skill_id, int nameid,
clif->produce_effect(sd,0,nameid);
clif->misceffect(&sd->bl,3);
if(itemdb_wlv(nameid) >= 3 && ((ele? 1 : 0) + sc) >= 3) // Fame point system [DracoRPG]
- iPc->addfame(sd,10); // Success to forge a lv3 weapon with 3 additional ingredients = +10 fame point
+ pc->addfame(sd,10); // Success to forge a lv3 weapon with 3 additional ingredients = +10 fame point
} else {
int fame = 0;
tmp_item.amount = 0;
@@ -16333,7 +16350,7 @@ int skill_produce_mix (struct map_session_data *sd, uint16 skill_id, int nameid,
}
if (fame)
- iPc->addfame(sd,fame);
+ pc->addfame(sd,fame);
//Visual effects and the like.
switch (skill_id) {
case AM_PHARMACY:
@@ -16372,7 +16389,7 @@ int skill_produce_mix (struct map_session_data *sd, uint16 skill_id, int nameid,
for(j=0; j<5; j++){
if( rnd()%1000 < skill_changematerial_db[i].qty_rate[j] ){
tmp_item.amount = qty * skill_changematerial_db[i].qty[j];
- if((flag = iPc->additem(sd,&tmp_item,tmp_item.amount,LOG_TYPE_PRODUCE))) {
+ if((flag = pc->additem(sd,&tmp_item,tmp_item.amount,LOG_TYPE_PRODUCE))) {
clif->additem(sd,0,0,flag);
iMap->addflooritem(&tmp_item,tmp_item.amount,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0);
}
@@ -16386,7 +16403,7 @@ int skill_produce_mix (struct map_session_data *sd, uint16 skill_id, int nameid,
return 1;
}
} else if (tmp_item.amount) { //Success
- if((flag = iPc->additem(sd,&tmp_item,tmp_item.amount,LOG_TYPE_PRODUCE))) {
+ if((flag = pc->additem(sd,&tmp_item,tmp_item.amount,LOG_TYPE_PRODUCE))) {
clif->additem(sd,0,0,flag);
iMap->addflooritem(&tmp_item,tmp_item.amount,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0);
}
@@ -16438,7 +16455,7 @@ int skill_produce_mix (struct map_session_data *sd, uint16 skill_id, int nameid,
tmp_item.nameid = compensation[i];
tmp_item.amount = qty;
tmp_item.identify = 1;
- if( iPc->additem(sd,&tmp_item,tmp_item.amount,LOG_TYPE_PRODUCE) ) {
+ if( pc->additem(sd,&tmp_item,tmp_item.amount,LOG_TYPE_PRODUCE) ) {
clif->additem(sd,0,0,flag);
iMap->addflooritem(&tmp_item,tmp_item.amount,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0);
}
@@ -16478,10 +16495,10 @@ int skill_arrow_create (struct map_session_data *sd, int nameid)
break;
}
- if(index < 0 || (j = iPc->search_inventory(sd,nameid)) < 0)
+ if(index < 0 || (j = pc->search_inventory(sd,nameid)) < 0)
return 1;
- iPc->delitem(sd,j,1,0,0,LOG_TYPE_PRODUCE);
+ pc->delitem(sd,j,1,0,0,LOG_TYPE_PRODUCE);
for(i=0;i<MAX_ARROW_RESOURCE;i++) {
memset(&tmp_item,0,sizeof(tmp_item));
tmp_item.identify = 1;
@@ -16495,7 +16512,7 @@ int skill_arrow_create (struct map_session_data *sd, int nameid)
}
if(tmp_item.nameid <= 0 || tmp_item.amount <= 0)
continue;
- if((flag = iPc->additem(sd,&tmp_item,tmp_item.amount,LOG_TYPE_PRODUCE))) {
+ if((flag = pc->additem(sd,&tmp_item,tmp_item.amount,LOG_TYPE_PRODUCE))) {
clif->additem(sd,0,0,flag);
iMap->addflooritem(&tmp_item,tmp_item.amount,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0);
}
@@ -16507,7 +16524,7 @@ int skill_poisoningweapon( struct map_session_data *sd, int nameid) {
sc_type type;
int chance, i;
nullpo_ret(sd);
- if( nameid <= 0 || (i = iPc->search_inventory(sd,nameid)) < 0 || iPc->delitem(sd,i,1,0,0,LOG_TYPE_CONSUME) ) {
+ if( nameid <= 0 || (i = pc->search_inventory(sd,nameid)) < 0 || pc->delitem(sd,i,1,0,0,LOG_TYPE_CONSUME) ) {
clif->skill_fail(sd,GC_POISONINGWEAPON,USESKILL_FAIL_LEVEL,0);
return 0;
}
@@ -16527,7 +16544,7 @@ int skill_poisoningweapon( struct map_session_data *sd, int nameid) {
}
chance = 2 + 2 * sd->menuskill_val; // 2 + 2 * skill_lv
- sc_start4(&sd->bl, SC_POISONINGWEAPON, 100, iPc->checkskill(sd, GC_RESEARCHNEWPOISON), //in Aegis it store the level of GC_RESEARCHNEWPOISON in val1
+ sc_start4(&sd->bl, SC_POISONINGWEAPON, 100, pc->checkskill(sd, GC_RESEARCHNEWPOISON), //in Aegis it store the level of GC_RESEARCHNEWPOISON in val1
type, chance, 0, skill->get_time(GC_POISONINGWEAPON, sd->menuskill_val));
return 0;
@@ -16563,14 +16580,14 @@ int skill_magicdecoy(struct map_session_data *sd, int nameid) {
nullpo_ret(sd);
skill_id = sd->menuskill_val;
- if( nameid <= 0 || !itemdb_is_element(nameid) || (i = iPc->search_inventory(sd,nameid)) < 0 || !skill_id || iPc->delitem(sd,i,1,0,0,LOG_TYPE_CONSUME) )
+ if( nameid <= 0 || !itemdb_is_element(nameid) || (i = pc->search_inventory(sd,nameid)) < 0 || !skill_id || pc->delitem(sd,i,1,0,0,LOG_TYPE_CONSUME) )
{
clif->skill_fail(sd,NC_MAGICDECOY,USESKILL_FAIL_LEVEL,0);
return 0;
}
// Spawn Position
- iPc->delitem(sd,i,1,0,0,LOG_TYPE_CONSUME);
+ pc->delitem(sd,i,1,0,0,LOG_TYPE_CONSUME);
x = sd->sc.comet_x;
y = sd->sc.comet_y;
sd->sc.comet_x = sd->sc.comet_y = 0;
@@ -16613,14 +16630,14 @@ int skill_spellbook (struct map_session_data *sd, int nameid) {
ARR_FIND(0,MAX_SKILL_SPELLBOOK_DB,i,skill_spellbook_db[i].nameid == nameid); // Search for information of this item
if( i == MAX_SKILL_SPELLBOOK_DB ) return 0;
- if( !iPc->checkskill(sd, (skill_id = skill_spellbook_db[i].skill_id)) )
+ if( !pc->checkskill(sd, (skill_id = skill_spellbook_db[i].skill_id)) )
{ // User don't know the skill
- sc_start(&sd->bl, SC_SLEEP, 100, 1, skill->get_time(WL_READING_SB, iPc->checkskill(sd,WL_READING_SB)));
+ sc_start(&sd->bl, SC_SLEEP, 100, 1, skill->get_time(WL_READING_SB, pc->checkskill(sd,WL_READING_SB)));
clif->skill_fail(sd, WL_READING_SB, USESKILL_FAIL_SPELLBOOK_DIFFICULT_SLEEP, 0);
return 0;
}
- max_preserve = 4 * iPc->checkskill(sd, WL_FREEZE_SP) + status_get_int(&sd->bl) / 10 + sd->status.base_level / 10;
+ max_preserve = 4 * pc->checkskill(sd, WL_FREEZE_SP) + status_get_int(&sd->bl) / 10 + sd->status.base_level / 10;
point = skill_spellbook_db[i].point;
if( sc && sc->data[SC_READING_SB] ) {
@@ -16631,13 +16648,13 @@ int skill_spellbook (struct map_session_data *sd, int nameid) {
for(i = SC_MAXSPELLBOOK; i >= SC_SPELLBOOK1; i--){ // This is how official saves spellbook. [malufett]
if( !sc->data[i] ){
sc->data[SC_READING_SB]->val2 += point; // increase points
- sc_start4(&sd->bl, (sc_type)i, 100, skill_id, iPc->checkskill(sd,skill_id), point, 0, INVALID_TIMER);
+ sc_start4(&sd->bl, (sc_type)i, 100, skill_id, pc->checkskill(sd,skill_id), point, 0, INVALID_TIMER);
break;
}
}
}else{
sc_start2(&sd->bl, SC_READING_SB, 100, 0, point, INVALID_TIMER);
- sc_start4(&sd->bl, SC_MAXSPELLBOOK, 100, skill_id, iPc->checkskill(sd,skill_id), point, 0, INVALID_TIMER);
+ sc_start4(&sd->bl, SC_MAXSPELLBOOK, 100, skill_id, pc->checkskill(sd,skill_id), point, 0, INVALID_TIMER);
}
return 1;
@@ -16706,7 +16723,7 @@ int skill_elementalanalysis(struct map_session_data* sd, int n, uint16 skill_lv,
return 1;
}
- if( iPc->delitem(sd,idx,del_amount,0,1,LOG_TYPE_CONSUME) ) {
+ if( pc->delitem(sd,idx,del_amount,0,1,LOG_TYPE_CONSUME) ) {
clif->skill_fail(sd,SO_EL_ANALYSIS,USESKILL_FAIL_LEVEL,0);
return 1;
}
@@ -16723,7 +16740,7 @@ int skill_elementalanalysis(struct map_session_data* sd, int n, uint16 skill_lv,
tmp_item.identify = 1;
if( tmp_item.amount ) {
- if( (flag = iPc->additem(sd,&tmp_item,tmp_item.amount,LOG_TYPE_CONSUME)) ) {
+ if( (flag = pc->additem(sd,&tmp_item,tmp_item.amount,LOG_TYPE_CONSUME)) ) {
clif->additem(sd,0,0,flag);
iMap->addflooritem(&tmp_item,tmp_item.amount,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0);
}
@@ -16873,7 +16890,7 @@ int skill_blockpc_start_(struct map_session_data *sd, uint16 skill_id, int tick,
}
if( battle_config.display_status_timers )
- clif->skill_cooldown(sd, idx, tick);
+ clif->skill_cooldown(sd, skill_id, tick);
if( !load ) {// not being loaded initially so ensure the skill delay is recorded
if( !(cd = idb_get(skillcd_db,sd->status.char_id)) ) {// create a new skill cooldown object for map storage
@@ -17591,6 +17608,7 @@ bool skill_parse_row_unitdb(char* split[], int columns, int current) {
else if( strcmpi(split[6],"all")==0 ) skill_db[idx].unit_target = BCT_ALL;
else if( strcmpi(split[6],"enemy")==0 ) skill_db[idx].unit_target = BCT_ENEMY;
else if( strcmpi(split[6],"self")==0 ) skill_db[idx].unit_target = BCT_SELF;
+ else if( strcmpi(split[6],"sameguild")==0 ) skill_db[idx].unit_target = BCT_GUILD|BCT_SAMEGUILD;
else if( strcmpi(split[6],"noone")==0 ) skill_db[idx].unit_target = BCT_NOONE;
else skill_db[idx].unit_target = strtol(split[6],NULL,16);
diff --git a/src/map/status.c b/src/map/status.c
index 09350fff0..c163135d8 100644
--- a/src/map/status.c
+++ b/src/map/status.c
@@ -1199,7 +1199,7 @@ int status_damage(struct block_list *src,struct block_list *target,int hp, int s
}
switch (target->type) {
- case BL_PC: iPc->damage((TBL_PC*)target,src,hp,sp); break;
+ case BL_PC: pc->damage((TBL_PC*)target,src,hp,sp); break;
case BL_MOB: mob_damage((TBL_MOB*)target, src, hp); break;
case BL_HOM: homun->damaged((TBL_HOM*)target); break;
case BL_MER: mercenary_heal((TBL_MER*)target,hp,sp); break;
@@ -1224,7 +1224,7 @@ int status_damage(struct block_list *src,struct block_list *target,int hp, int s
//&2: Also remove object from map.
//&4: Also delete object from memory.
switch (target->type) {
- case BL_PC: flag = iPc->dead((TBL_PC*)target,src); break;
+ case BL_PC: flag = pc->dead((TBL_PC*)target,src); break;
case BL_MOB: flag = mob_dead((TBL_MOB*)target, src, flag&4?3:0); break;
case BL_HOM: flag = homun->dead((TBL_HOM*)target); break;
case BL_MER: flag = mercenary_dead((TBL_MER*)target); break;
@@ -1370,7 +1370,7 @@ int status_heal(struct block_list *bl,int hp,int sp, int flag)
// send hp update to client
switch(bl->type) {
- case BL_PC: iPc->heal((TBL_PC*)bl,hp,sp,flag&2?1:0); break;
+ case BL_PC: pc->heal((TBL_PC*)bl,hp,sp,flag&2?1:0); break;
case BL_MOB: mob_heal((TBL_MOB*)bl,hp); break;
case BL_HOM: homun->healed((TBL_HOM*)bl); break;
case BL_MER: mercenary_heal((TBL_MER*)bl,hp,sp); break;
@@ -1474,7 +1474,7 @@ int status_revive(struct block_list *bl, unsigned char per_hp, unsigned char per
if (bl->prev) //Animation only if character is already on a map.
clif->resurrection(bl, 1);
switch (bl->type) {
- case BL_PC: iPc->revive((TBL_PC*)bl, hp, sp); break;
+ case BL_PC: pc->revive((TBL_PC*)bl, hp, sp); break;
case BL_MOB: mob_revive((TBL_MOB*)bl, hp); break;
case BL_HOM: homun->revive((TBL_HOM*)bl, hp, sp); break;
}
@@ -1516,7 +1516,7 @@ int status_check_skilluse(struct block_list *src, struct block_list *target, uin
if( skill_id ) {
- if( src ) {
+ if( src && !(src->type == BL_PC && ((TBL_PC*)src)->skillitem)) { // Items that cast skills using 'itemskill' will not be handled by map_zone_db.
int i;
for(i = 0; i < map[src->m].zone->disabled_skills_count; i++) {
@@ -1597,7 +1597,7 @@ int status_check_skilluse(struct block_list *src, struct block_list *target, uin
if (sc->data[SC_DANCING] && flag!=2) {
if( src->type == BL_PC && skill_id >= WA_SWING_DANCE && skill_id <= WM_UNLIMITED_HUMMING_VOICE )
{ // Lvl 5 Lesson or higher allow you use 3rd job skills while dancing.v
- if( iPc->checkskill((TBL_PC*)src,WM_LESSON) < 5 )
+ if( pc->checkskill((TBL_PC*)src,WM_LESSON) < 5 )
return 0;
} else if(sc->data[SC_LONGING]) { //Allow everything except dancing/re-dancing. [Skotlex]
if (skill_id == BD_ENCORE ||
@@ -1813,21 +1813,21 @@ int status_base_amotion_pc(struct map_session_data* sd, struct status_data* stat
}
amotion = ( sd->status.weapon < MAX_WEAPON_TYPE && mod < 0 )
- ? (aspd_base[iPc->class2idx(sd->status.class_)][sd->status.weapon]) // single weapon
- : ((aspd_base[iPc->class2idx(sd->status.class_)][sd->weapontype2] // dual-wield
- + aspd_base[iPc->class2idx(sd->status.class_)][sd->weapontype2]) * 6 / 10 + 10 * mod
- - aspd_base[iPc->class2idx(sd->status.class_)][sd->weapontype2]
- + aspd_base[iPc->class2idx(sd->status.class_)][sd->weapontype1]);
+ ? (aspd_base[pc->class2idx(sd->status.class_)][sd->status.weapon]) // single weapon
+ : ((aspd_base[pc->class2idx(sd->status.class_)][sd->weapontype2] // dual-wield
+ + aspd_base[pc->class2idx(sd->status.class_)][sd->weapontype2]) * 6 / 10 + 10 * mod
+ - aspd_base[pc->class2idx(sd->status.class_)][sd->weapontype2]
+ + aspd_base[pc->class2idx(sd->status.class_)][sd->weapontype1]);
if ( sd->status.shield )
- amotion += ( 2000 - aspd_base[iPc->class2idx(sd->status.class_)][W_FIST] ) +
- ( aspd_base[iPc->class2idx(sd->status.class_)][MAX_WEAPON_TYPE] - 2000 );
+ amotion += ( 2000 - aspd_base[pc->class2idx(sd->status.class_)][W_FIST] ) +
+ ( aspd_base[pc->class2idx(sd->status.class_)][MAX_WEAPON_TYPE] - 2000 );
#else
// base weapon delay
amotion = (sd->status.weapon < MAX_WEAPON_TYPE)
- ? (aspd_base[iPc->class2idx(sd->status.class_)][sd->status.weapon]) // single weapon
- : (aspd_base[iPc->class2idx(sd->status.class_)][sd->weapontype1] + aspd_base[iPc->class2idx(sd->status.class_)][sd->weapontype2])*7/10; // dual-wield
+ ? (aspd_base[pc->class2idx(sd->status.class_)][sd->status.weapon]) // single weapon
+ : (aspd_base[pc->class2idx(sd->status.class_)][sd->weapontype1] + aspd_base[pc->class2idx(sd->status.class_)][sd->weapontype2])*7/10; // dual-wield
// percentual delay reduction from stats
amotion -= amotion * (4*status->agi + status->dex)/1000;
@@ -2222,12 +2222,12 @@ static void status_calc_sigma(void)
/// f(x) = 35 + x*(A + B*C/D) + sum(i=2..x){ i*C/D }
static unsigned int status_base_pc_maxhp(struct map_session_data* sd, struct status_data* status)
{
- uint64 val = iPc->class2idx(sd->status.class_);
+ uint64 val = pc->class2idx(sd->status.class_);
val = 35 + sd->status.base_level*(int64)hp_coefficient2[val]/100 + hp_sigma_val[val][sd->status.base_level];
if((sd->class_&MAPID_UPPERMASK) == MAPID_NINJA || (sd->class_&MAPID_UPPERMASK) == MAPID_GUNSLINGER)
val += 100; //Since their HP can't be approximated well enough without this.
- if((sd->class_&MAPID_UPPERMASK) == MAPID_TAEKWON && sd->status.base_level >= 90 && iPc->famerank(sd->status.char_id, MAPID_TAEKWON))
+ if((sd->class_&MAPID_UPPERMASK) == MAPID_TAEKWON && sd->status.base_level >= 90 && pc->famerank(sd->status.char_id, MAPID_TAEKWON))
val *= 3; //Triple max HP for top ranking Taekwons over level 90.
if((sd->class_&MAPID_UPPERMASK) == MAPID_SUPER_NOVICE && sd->status.base_level >= 99)
val += 2000; //Supernovice lvl99 hp bonus.
@@ -2245,14 +2245,14 @@ static unsigned int status_base_pc_maxsp(struct map_session_data* sd, struct sta
{
uint64 val;
- val = 10 + sd->status.base_level*(int64)sp_coefficient[iPc->class2idx(sd->status.class_)]/100;
+ val = 10 + sd->status.base_level*(int64)sp_coefficient[pc->class2idx(sd->status.class_)]/100;
val += val * status->int_/100;
if (sd->class_&JOBL_UPPER)
val += val * 25/100;
else if (sd->class_&JOBL_BABY)
val -= val * 30/100;
- if ((sd->class_&MAPID_UPPERMASK) == MAPID_TAEKWON && sd->status.base_level >= 90 && iPc->famerank(sd->status.char_id, MAPID_TAEKWON))
+ if ((sd->class_&MAPID_UPPERMASK) == MAPID_TAEKWON && sd->status.base_level >= 90 && pc->famerank(sd->status.char_id, MAPID_TAEKWON))
val *= 3; //Triple max SP for top ranking Taekwons over level 90.
return (unsigned int)val;
@@ -2279,9 +2279,9 @@ int status_calc_pc_(struct map_session_data* sd, bool first)
b_max_weight = sd->max_weight;
b_cart_weight_max = sd->cart_weight_max;
- iPc->calc_skilltree(sd); // SkillTree calculation
+ pc->calc_skilltree(sd); // SkillTree calculation
- sd->max_weight = max_weight_base[iPc->class2idx(sd->status.class_)]+sd->status.str*300;
+ sd->max_weight = max_weight_base[pc->class2idx(sd->status.class_)]+sd->status.str*300;
if(first) {
//Load Hp/SP from char-received data.
@@ -2410,9 +2410,9 @@ int status_calc_pc_(struct map_session_data* sd, bool first)
memset (&sd->bonus, 0,sizeof(sd->bonus));
// Autobonus
- iPc->delautobonus(sd,sd->autobonus,ARRAYLENGTH(sd->autobonus),true);
- iPc->delautobonus(sd,sd->autobonus2,ARRAYLENGTH(sd->autobonus2),true);
- iPc->delautobonus(sd,sd->autobonus3,ARRAYLENGTH(sd->autobonus3),true);
+ pc->delautobonus(sd,sd->autobonus,ARRAYLENGTH(sd->autobonus),true);
+ pc->delautobonus(sd,sd->autobonus2,ARRAYLENGTH(sd->autobonus2),true);
+ pc->delautobonus(sd,sd->autobonus3,ARRAYLENGTH(sd->autobonus3),true);
// Parse equipment.
for(i=0;i<EQI_MAX-1;i++) {
@@ -2498,7 +2498,7 @@ int status_calc_pc_(struct map_session_data* sd, bool first)
{ // Forged weapon
wd->star += (sd->status.inventory[index].card[1]>>8);
if(wd->star >= 15) wd->star = 40; // 3 Star Crumbs now give +40 dmg
- if(iPc->famerank(MakeDWord(sd->status.inventory[index].card[2],sd->status.inventory[index].card[3]) ,MAPID_BLACKSMITH))
+ if(pc->famerank(MakeDWord(sd->status.inventory[index].card[2],sd->status.inventory[index].card[3]) ,MAPID_BLACKSMITH))
wd->star += 10;
if (!wa->ele) //Do not overwrite element from previous bonuses.
@@ -2617,7 +2617,7 @@ int status_calc_pc_(struct map_session_data* sd, bool first)
if( pd && pd->petDB && pd->petDB->equip_script && pd->pet.intimate >= battle_config.pet_equip_min_friendly )
run_script(pd->petDB->equip_script,0,sd->bl.id,0);
if( pd && pd->pet.intimate > 0 && (!battle_config.pet_equip_required || pd->pet.equip > 0) && pd->state.skillbonus == 1 && pd->bonus )
- iPc->bonus(sd,pd->bonus->type, pd->bonus->val);
+ pc->bonus(sd,pd->bonus->type, pd->bonus->val);
}
//param_bonus now holds card bonuses.
@@ -2649,7 +2649,7 @@ int status_calc_pc_(struct map_session_data* sd, bool first)
// ----- STATS CALCULATION -----
// Job bonuses
- index = iPc->class2idx(sd->status.class_);
+ index = pc->class2idx(sd->status.class_);
for(i=0;i<(int)sd->status.job_level && i<MAX_LEVEL;i++){
if(!job_bonus[index][i])
continue;
@@ -2674,13 +2674,13 @@ int status_calc_pc_(struct map_session_data* sd, bool first)
}
// Absolute modifiers from passive skills
- if(iPc->checkskill(sd,BS_HILTBINDING)>0)
+ if(pc->checkskill(sd,BS_HILTBINDING)>0)
status->str++;
- if((skill=iPc->checkskill(sd,SA_DRAGONOLOGY))>0)
+ if((skill=pc->checkskill(sd,SA_DRAGONOLOGY))>0)
status->int_ += (skill+1)/2; // +1 INT / 2 lv
- if((skill=iPc->checkskill(sd,AC_OWL))>0)
+ if((skill=pc->checkskill(sd,AC_OWL))>0)
status->dex += skill;
- if((skill = iPc->checkskill(sd,RA_RESEARCHTRAP))>0)
+ if((skill = pc->checkskill(sd,RA_RESEARCHTRAP))>0)
status->int_ += skill;
// Bonuses from cards and equipment as well as base stat, remember to avoid overflows.
@@ -2704,7 +2704,7 @@ int status_calc_pc_(struct map_session_data* sd, bool first)
if (sd->status.weapon < MAX_WEAPON_TYPE && sd->weapon_atk[sd->status.weapon])
status->batk += sd->weapon_atk[sd->status.weapon];
// Absolute modifiers from passive skills
- if((skill=iPc->checkskill(sd,BS_HILTBINDING))>0)
+ if((skill=pc->checkskill(sd,BS_HILTBINDING))>0)
status->batk += 4;
// ----- HP MAX CALCULATION -----
@@ -2717,7 +2717,7 @@ int status_calc_pc_(struct map_session_data* sd, bool first)
status->max_hp = (unsigned int)cap_value(i64, 0, INT_MAX);
// Absolute modifiers from passive skills
- if((skill=iPc->checkskill(sd,CR_TRUST))>0)
+ if((skill=pc->checkskill(sd,CR_TRUST))>0)
status->max_hp += skill*200;
// Apply relative modifiers from equipment
@@ -2742,15 +2742,15 @@ int status_calc_pc_(struct map_session_data* sd, bool first)
status->max_sp = (unsigned int)cap_value(i64, 0, INT_MAX);
// Absolute modifiers from passive skills
- if((skill=iPc->checkskill(sd,SL_KAINA))>0)
+ if((skill=pc->checkskill(sd,SL_KAINA))>0)
status->max_sp += 30*skill;
- if((skill=iPc->checkskill(sd,HP_MEDITATIO))>0)
+ if((skill=pc->checkskill(sd,HP_MEDITATIO))>0)
status->max_sp += (int64)status->max_sp * skill/100;
- if((skill=iPc->checkskill(sd,HW_SOULDRAIN))>0)
+ if((skill=pc->checkskill(sd,HW_SOULDRAIN))>0)
status->max_sp += (int64)status->max_sp * 2*skill/100;
- if( (skill = iPc->checkskill(sd,RA_RESEARCHTRAP)) > 0 )
+ if( (skill = pc->checkskill(sd,RA_RESEARCHTRAP)) > 0 )
status->max_sp += 200 + 20 * skill;
- if( (skill = iPc->checkskill(sd,WM_LESSON)) > 0 )
+ if( (skill = pc->checkskill(sd,WM_LESSON)) > 0 )
status->max_sp += 30 * skill;
@@ -2834,9 +2834,9 @@ int status_calc_pc_(struct map_session_data* sd, bool first)
// ----- HIT CALCULATION -----
// Absolute modifiers from passive skills
- if((skill=iPc->checkskill(sd,BS_WEAPONRESEARCH))>0)
+ if((skill=pc->checkskill(sd,BS_WEAPONRESEARCH))>0)
status->hit += skill*2;
- if((skill=iPc->checkskill(sd,AC_VULTURE))>0){
+ if((skill=pc->checkskill(sd,AC_VULTURE))>0){
#ifndef RENEWAL
status->hit += skill;
#endif
@@ -2845,9 +2845,9 @@ int status_calc_pc_(struct map_session_data* sd, bool first)
}
if(sd->status.weapon >= W_REVOLVER && sd->status.weapon <= W_GRENADE)
{
- if((skill=iPc->checkskill(sd,GS_SINGLEACTION))>0)
+ if((skill=pc->checkskill(sd,GS_SINGLEACTION))>0)
status->hit += 2*skill;
- if((skill=iPc->checkskill(sd,GS_SNAKEEYE))>0) {
+ if((skill=pc->checkskill(sd,GS_SNAKEEYE))>0) {
status->hit += skill;
status->rhw.range += skill;
}
@@ -2856,9 +2856,9 @@ int status_calc_pc_(struct map_session_data* sd, bool first)
// ----- FLEE CALCULATION -----
// Absolute modifiers from passive skills
- if((skill=iPc->checkskill(sd,TF_MISS))>0)
+ if((skill=pc->checkskill(sd,TF_MISS))>0)
status->flee += skill*(sd->class_&JOBL_2 && (sd->class_&MAPID_BASEMASK) == MAPID_THIEF? 4 : 3);
- if((skill=iPc->checkskill(sd,MO_DODGE))>0)
+ if((skill=pc->checkskill(sd,MO_DODGE))>0)
status->flee += (skill*3)>>1;
// ----- EQUIPMENT-DEF CALCULATION -----
@@ -2905,29 +2905,29 @@ int status_calc_pc_(struct map_session_data* sd, bool first)
// Relative modifiers from passive skills
#ifndef RENEWAL_ASPD
- if((skill=iPc->checkskill(sd,SA_ADVANCEDBOOK))>0 && sd->status.weapon == W_BOOK)
+ if((skill=pc->checkskill(sd,SA_ADVANCEDBOOK))>0 && sd->status.weapon == W_BOOK)
status->aspd_rate -= 5*skill;
- if((skill = iPc->checkskill(sd,SG_DEVIL)) > 0 && !iPc->nextjobexp(sd))
+ if((skill = pc->checkskill(sd,SG_DEVIL)) > 0 && !pc->nextjobexp(sd))
status->aspd_rate -= 30*skill;
- if((skill=iPc->checkskill(sd,GS_SINGLEACTION))>0 &&
+ if((skill=pc->checkskill(sd,GS_SINGLEACTION))>0 &&
(sd->status.weapon >= W_REVOLVER && sd->status.weapon <= W_GRENADE))
status->aspd_rate -= ((skill+1)/2) * 10;
if(pc_isriding(sd))
- status->aspd_rate += 500-100*iPc->checkskill(sd,KN_CAVALIERMASTERY);
+ status->aspd_rate += 500-100*pc->checkskill(sd,KN_CAVALIERMASTERY);
else if(pc_isridingdragon(sd))
- status->aspd_rate += 250-50*iPc->checkskill(sd,RK_DRAGONTRAINING);
+ status->aspd_rate += 250-50*pc->checkskill(sd,RK_DRAGONTRAINING);
#else // needs more info
- if((skill=iPc->checkskill(sd,SA_ADVANCEDBOOK))>0 && sd->status.weapon == W_BOOK)
+ if((skill=pc->checkskill(sd,SA_ADVANCEDBOOK))>0 && sd->status.weapon == W_BOOK)
status->aspd_rate += 5*skill;
- if((skill = iPc->checkskill(sd,SG_DEVIL)) > 0 && !iPc->nextjobexp(sd))
+ if((skill = pc->checkskill(sd,SG_DEVIL)) > 0 && !pc->nextjobexp(sd))
status->aspd_rate += 30*skill;
- if((skill=iPc->checkskill(sd,GS_SINGLEACTION))>0 &&
+ if((skill=pc->checkskill(sd,GS_SINGLEACTION))>0 &&
(sd->status.weapon >= W_REVOLVER && sd->status.weapon <= W_GRENADE))
status->aspd_rate += ((skill+1)/2) * 10;
if(pc_isriding(sd))
- status->aspd_rate -= 500-100*iPc->checkskill(sd,KN_CAVALIERMASTERY);
+ status->aspd_rate -= 500-100*pc->checkskill(sd,KN_CAVALIERMASTERY);
else if(pc_isridingdragon(sd))
- status->aspd_rate -= 250-50*iPc->checkskill(sd,RK_DRAGONTRAINING);
+ status->aspd_rate -= 250-50*pc->checkskill(sd,RK_DRAGONTRAINING);
#endif
status->adelay = 2*status->amotion;
@@ -2942,26 +2942,26 @@ int status_calc_pc_(struct map_session_data* sd, bool first)
// ----- MISC CALCULATIONS -----
// Weight
- if((skill=iPc->checkskill(sd,MC_INCCARRY))>0)
+ if((skill=pc->checkskill(sd,MC_INCCARRY))>0)
sd->max_weight += 2000*skill;
- if(pc_isriding(sd) && iPc->checkskill(sd,KN_RIDING)>0)
+ if(pc_isriding(sd) && pc->checkskill(sd,KN_RIDING)>0)
sd->max_weight += 10000;
else if(pc_isridingdragon(sd))
- sd->max_weight += 5000+2000*iPc->checkskill(sd,RK_DRAGONTRAINING);
+ sd->max_weight += 5000+2000*pc->checkskill(sd,RK_DRAGONTRAINING);
if(sc->data[SC_KNOWLEDGE])
sd->max_weight += sd->max_weight*sc->data[SC_KNOWLEDGE]->val1/10;
- if((skill=iPc->checkskill(sd,ALL_INCCARRY))>0)
+ if((skill=pc->checkskill(sd,ALL_INCCARRY))>0)
sd->max_weight += 2000*skill;
- sd->cart_weight_max = battle_config.max_cart_weight + (iPc->checkskill(sd, GN_REMODELING_CART)*5000);
+ sd->cart_weight_max = battle_config.max_cart_weight + (pc->checkskill(sd, GN_REMODELING_CART)*5000);
- if (iPc->checkskill(sd,SM_MOVINGRECOVERY)>0)
+ if (pc->checkskill(sd,SM_MOVINGRECOVERY)>0)
sd->regen.state.walk = 1;
else
sd->regen.state.walk = 0;
// Skill SP cost
- if((skill=iPc->checkskill(sd,HP_MANARECHARGE))>0 )
+ if((skill=pc->checkskill(sd,HP_MANARECHARGE))>0 )
sd->dsprate -= 4*skill;
if(sc->data[SC_SERVICE4U])
@@ -2983,17 +2983,17 @@ int status_calc_pc_(struct map_session_data* sd, bool first)
sd->sprecov_rate = 0;
// Anti-element and anti-race
- if((skill=iPc->checkskill(sd,CR_TRUST))>0)
+ if((skill=pc->checkskill(sd,CR_TRUST))>0)
sd->subele[ELE_HOLY] += skill*5;
- if((skill=iPc->checkskill(sd,BS_SKINTEMPER))>0) {
+ if((skill=pc->checkskill(sd,BS_SKINTEMPER))>0) {
sd->subele[ELE_NEUTRAL] += skill;
sd->subele[ELE_FIRE] += skill*4;
}
- if((skill=iPc->checkskill(sd,NC_RESEARCHFE))>0) {
+ if((skill=pc->checkskill(sd,NC_RESEARCHFE))>0) {
sd->subele[ELE_EARTH] += skill*10;
sd->subele[ELE_FIRE] += skill*10;
}
- if((skill=iPc->checkskill(sd,SA_DRAGONOLOGY))>0 ){
+ if((skill=pc->checkskill(sd,SA_DRAGONOLOGY))>0 ){
skill = skill*4;
sd->right_weapon.addrace[RC_DRAGON]+=skill;
sd->left_weapon.addrace[RC_DRAGON]+=skill;
@@ -3077,7 +3077,7 @@ int status_calc_pc_(struct map_session_data* sd, bool first)
clif->updatestatus(sd,SP_WEIGHT);
if(b_max_weight != sd->max_weight) {
clif->updatestatus(sd,SP_MAXWEIGHT);
- iPc->updateweightstatus(sd);
+ pc->updateweightstatus(sd);
}
if( b_cart_weight_max != sd->cart_weight_max ) {
clif->updatestatus(sd,SP_CARTINFO);
@@ -3324,7 +3324,7 @@ void status_calc_regen(struct block_list *bl, struct status_data *status, struct
if( sd )
{
struct regen_data_sub *sregen;
- if( (skill=iPc->checkskill(sd,HP_MEDITATIO)) > 0 )
+ if( (skill=pc->checkskill(sd,HP_MEDITATIO)) > 0 )
{
val = regen->sp*(100+3*skill)/100;
regen->sp = cap_value(val, 1, SHRT_MAX);
@@ -3333,16 +3333,16 @@ void status_calc_regen(struct block_list *bl, struct status_data *status, struct
sregen = regen->sregen;
val = 0;
- if( (skill=iPc->checkskill(sd,SM_RECOVERY)) > 0 )
+ if( (skill=pc->checkskill(sd,SM_RECOVERY)) > 0 )
val += skill*5 + skill*status->max_hp/500;
sregen->hp = cap_value(val, 0, SHRT_MAX);
val = 0;
- if( (skill=iPc->checkskill(sd,MG_SRECOVERY)) > 0 )
+ if( (skill=pc->checkskill(sd,MG_SRECOVERY)) > 0 )
val += skill*3 + skill*status->max_sp/500;
- if( (skill=iPc->checkskill(sd,NJ_NINPOU)) > 0 )
+ if( (skill=pc->checkskill(sd,NJ_NINPOU)) > 0 )
val += skill*3 + skill*status->max_sp/500;
- if( (skill=iPc->checkskill(sd,WM_LESSON)) > 0 )
+ if( (skill=pc->checkskill(sd,WM_LESSON)) > 0 )
val += 3 + 3 * skill;
sregen->sp = cap_value(val, 0, SHRT_MAX);
@@ -3351,21 +3351,21 @@ void status_calc_regen(struct block_list *bl, struct status_data *status, struct
sregen = regen->ssregen;
val = 0;
- if( (skill=iPc->checkskill(sd,MO_SPIRITSRECOVERY)) > 0 )
+ if( (skill=pc->checkskill(sd,MO_SPIRITSRECOVERY)) > 0 )
val += skill*4 + skill*status->max_hp/500;
- if( (skill=iPc->checkskill(sd,TK_HPTIME)) > 0 && sd->state.rest )
+ if( (skill=pc->checkskill(sd,TK_HPTIME)) > 0 && sd->state.rest )
val += skill*30 + skill*status->max_hp/500;
sregen->hp = cap_value(val, 0, SHRT_MAX);
val = 0;
- if( (skill=iPc->checkskill(sd,TK_SPTIME)) > 0 && sd->state.rest )
+ if( (skill=pc->checkskill(sd,TK_SPTIME)) > 0 && sd->state.rest )
{
val += skill*3 + skill*status->max_sp/500;
- if ((skill=iPc->checkskill(sd,SL_KAINA)) > 0) //Power up Enjoyable Rest
+ if ((skill=pc->checkskill(sd,SL_KAINA)) > 0) //Power up Enjoyable Rest
val += (30+10*skill)*val/100;
}
- if( (skill=iPc->checkskill(sd,MO_SPIRITSRECOVERY)) > 0 )
+ if( (skill=pc->checkskill(sd,MO_SPIRITSRECOVERY)) > 0 )
val += skill*2 + skill*status->max_sp/500;
sregen->sp = cap_value(val, 0, SHRT_MAX);
}
@@ -5015,12 +5015,12 @@ static unsigned short status_calc_speed(struct block_list *bl, struct status_cha
if (sd && sd->state.permanent_speed)
return (short)cap_value(speed,10,USHRT_MAX);
- if( sd && sd->ud.skilltimer != INVALID_TIMER && (iPc->checkskill(sd,SA_FREECAST) > 0 || sd->ud.skill_id == LG_EXEEDBREAK) )
+ if( sd && sd->ud.skilltimer != INVALID_TIMER && (pc->checkskill(sd,SA_FREECAST) > 0 || sd->ud.skill_id == LG_EXEEDBREAK) )
{
if( sd->ud.skill_id == LG_EXEEDBREAK )
speed_rate = 100 + 60 - (sd->ud.skill_lv * 10);
else
- speed_rate = 175 - 5 * iPc->checkskill(sd,SA_FREECAST);
+ speed_rate = 175 - 5 * pc->checkskill(sd,SA_FREECAST);
}
else
{
@@ -5036,9 +5036,9 @@ static unsigned short status_calc_speed(struct block_list *bl, struct status_cha
if( pc_isriding(sd) || sd->sc.option&(OPTION_DRAGON) || sd->sc.data[SC_ALL_RIDING] )
val = 25;//Same bonus
else if( pc_isridingwug(sd) )
- val = 15 + 5 * iPc->checkskill(sd, RA_WUGRIDER);
+ val = 15 + 5 * pc->checkskill(sd, RA_WUGRIDER);
else if( pc_ismadogear(sd) ) {
- val = (- 10 * (5 - iPc->checkskill(sd,NC_MADOLICENCE)));
+ val = (- 10 * (5 - pc->checkskill(sd,NC_MADOLICENCE)));
if( sc->data[SC_ACCELERATION] )
val += 25;
}
@@ -5051,8 +5051,8 @@ static unsigned short status_calc_speed(struct block_list *bl, struct status_cha
{
int val = 0;
- if( sd && sc->data[SC_HIDING] && iPc->checkskill(sd,RG_TUNNELDRIVE) > 0 )
- val = 120 - 6 * iPc->checkskill(sd,RG_TUNNELDRIVE);
+ if( sd && sc->data[SC_HIDING] && pc->checkskill(sd,RG_TUNNELDRIVE) > 0 )
+ val = 120 - 6 * pc->checkskill(sd,RG_TUNNELDRIVE);
else
if( sd && sc->data[SC_CHASEWALK] && sc->data[SC_CHASEWALK]->val3 < 0 )
val = sc->data[SC_CHASEWALK]->val3;
@@ -5063,7 +5063,7 @@ static unsigned short status_calc_speed(struct block_list *bl, struct status_cha
val = max( val, 50 - 10 * sc->data[SC_LONGING]->val1 );
else
if( sd && sc->data[SC_DANCING] )
- val = max( val, 500 - (40 + 10 * (sc->data[SC_SPIRIT] && sc->data[SC_SPIRIT]->val2 == SL_BARDDANCER)) * iPc->checkskill(sd,(sd->status.sex?BA_MUSICALLESSON:DC_DANCINGLESSON)) );
+ val = max( val, 500 - (40 + 10 * (sc->data[SC_SPIRIT] && sc->data[SC_SPIRIT]->val2 == SL_BARDDANCER)) * pc->checkskill(sd,(sd->status.sex?BA_MUSICALLESSON:DC_DANCINGLESSON)) );
if( sc->data[SC_DECREASEAGI] )
val = max( val, 25 );
@@ -5129,8 +5129,8 @@ static unsigned short status_calc_speed(struct block_list *bl, struct status_cha
val = max( val, 2 * sc->data[SC_WINDWALK]->val1 );
if( sc->data[SC_CARTBOOST] )
val = max( val, 20 );
- if( sd && (sd->class_&MAPID_UPPERMASK) == MAPID_ASSASSIN && iPc->checkskill(sd,TF_MISS) > 0 )
- val = max( val, 1 * iPc->checkskill(sd,TF_MISS) );
+ if( sd && (sd->class_&MAPID_UPPERMASK) == MAPID_ASSASSIN && pc->checkskill(sd,TF_MISS) > 0 )
+ val = max( val, 1 * pc->checkskill(sd,TF_MISS) );
if( sc->data[SC_CLOAKING] && (sc->data[SC_CLOAKING]->val4&1) == 1 )
val = max( val, sc->data[SC_CLOAKING]->val1 >= 10 ? 25 : 3 * sc->data[SC_CLOAKING]->val1 - 3 );
if (sc->data[SC_BERSERK] || sc->data[SC__BLOODYLUST])
@@ -5168,7 +5168,7 @@ static unsigned short status_calc_speed(struct block_list *bl, struct status_cha
//GetSpeed()
{
if( sd && pc_iscarton(sd) )
- speed += speed * (50 - 5 * iPc->checkskill(sd,MC_PUSHCART)) / 100;
+ speed += speed * (50 - 5 * pc->checkskill(sd,MC_PUSHCART)) / 100;
if( sc->data[SC_PARALYSE] )
speed += speed * 50 / 100;
if( speed_rate != 100 )
@@ -5321,7 +5321,7 @@ static short status_calc_fix_aspd(struct block_list *bl, struct status_change *s
|| sc->data[SC_WILD_STORM_OPTION]))
aspd -= 50; // +5 ASPD
if( sc && sc->data[SC_FIGHTINGSPIRIT] && sc->data[SC_FIGHTINGSPIRIT]->val2 )
- aspd -= (bl->type==BL_PC?iPc->checkskill((TBL_PC *)bl, RK_RUNEMASTERY):10) / 10 * 40;
+ aspd -= (bl->type==BL_PC?pc->checkskill((TBL_PC *)bl, RK_RUNEMASTERY):10) / 10 * 40;
return cap_value(aspd, 0, 2000); // will be recap for proper bl anyway
}
@@ -6603,7 +6603,8 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val
case SC_INCREASEAGI:
if(sd && pc_issit(sd)){
- iPc->setstand(sd);
+ pc->setstand(sd);
+ clif->standing(&sd->bl);
}
case SC_CONCENTRATE:
@@ -6622,7 +6623,7 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val
//Due to the cloaking card, we have to check the wall versus to known
//skill level rather than the used one. [Skotlex]
//if (sd && val1 < 3 && skill_check_cloaking(bl,NULL))
- if( sd && iPc->checkskill(sd, AS_CLOAKING) < 3 && !skill->check_cloaking(bl,NULL) )
+ if( sd && pc->checkskill(sd, AS_CLOAKING) < 3 && !skill->check_cloaking(bl,NULL) )
return 0;
break;
case SC_MODECHANGE:
@@ -6657,7 +6658,7 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val
i = sd->equip_index[EQI_HAND_R];
if (i>=0 && sd->inventory_data[i] && sd->inventory_data[i]->type == IT_WEAPON) {
opt_flag|=2;
- iPc->unequipitem(sd,i,3);
+ pc->unequipitem(sd,i,3);
}
if (!opt_flag) return 0;
}
@@ -6673,7 +6674,7 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val
i = sd->equip_index[EQI_HAND_L];
if ( i < 0 || !sd->inventory_data[i] || sd->inventory_data[i]->type != IT_ARMOR )
return 0;
- iPc->unequipitem(sd,i,3);
+ pc->unequipitem(sd,i,3);
}
if (tick == 1) return 1; //Minimal duration: Only strip without causing the SC
break;
@@ -6685,7 +6686,7 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val
i = sd->equip_index[EQI_ARMOR];
if ( i < 0 || !sd->inventory_data[i] )
return 0;
- iPc->unequipitem(sd,i,3);
+ pc->unequipitem(sd,i,3);
}
if (tick == 1) return 1; //Minimal duration: Only strip without causing the SC
break;
@@ -6697,7 +6698,7 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val
i = sd->equip_index[EQI_HEAD_TOP];
if ( i < 0 || !sd->inventory_data[i] )
return 0;
- iPc->unequipitem(sd,i,3);
+ pc->unequipitem(sd,i,3);
}
if (tick == 1) return 1; //Minimal duration: Only strip without causing the SC
break;
@@ -6758,7 +6759,7 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val
return 0;
break;
case SC_CAMOUFLAGE:
- if( sd && iPc->checkskill(sd, RA_CAMOUFLAGE) < 3 && !skill->check_camouflage(bl,NULL) )
+ if( sd && pc->checkskill(sd, RA_CAMOUFLAGE) < 3 && !skill->check_camouflage(bl,NULL) )
return 0;
break;
case SC__STRIPACCESSORY:
@@ -6767,11 +6768,11 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val
if( !(sd->bonus.unstripable_equip&EQI_ACC_L) ) {
i = sd->equip_index[EQI_ACC_L];
if( i >= 0 && sd->inventory_data[i] && sd->inventory_data[i]->type == IT_ARMOR )
- iPc->unequipitem(sd,i,3); //L-Accessory
+ pc->unequipitem(sd,i,3); //L-Accessory
} if( !(sd->bonus.unstripable_equip&EQI_ACC_R) ) {
i = sd->equip_index[EQI_ACC_R];
if( i >= 0 && sd->inventory_data[i] && sd->inventory_data[i]->type == IT_ARMOR )
- iPc->unequipitem(sd,i,3); //R-Accessory
+ pc->unequipitem(sd,i,3); //R-Accessory
}
if( i < 0 )
return 0;
@@ -7223,7 +7224,7 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val
val3 = 50*(val1+1); //Damage increase (+50 +50*lv%)
#endif
if( sd )//[Ind] - iROwiki says each level increases its duration by 3 seconds
- tick += iPc->checkskill(sd,GC_RESEARCHNEWPOISON)*3000;
+ tick += pc->checkskill(sd,GC_RESEARCHNEWPOISON)*3000;
break;
case SC_POISONREACT:
val2=(val1+1)/2 + val1/10; // Number of counters [Skotlex]
@@ -7794,14 +7795,14 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val
case SC_OVERTHRUST:
//val2 holds if it was casted on self, or is bonus received from others
val3 = 5*val1; //Power increase
- if(sd && iPc->checkskill(sd,BS_HILTBINDING)>0)
+ if(sd && pc->checkskill(sd,BS_HILTBINDING)>0)
tick += tick / 10;
break;
case SC_ADRENALINE2:
case SC_ADRENALINE:
val3 = (val2) ? 300 : 200; // aspd increase
case SC_WEAPONPERFECTION:
- if(sd && iPc->checkskill(sd,BS_HILTBINDING)>0)
+ if(sd && pc->checkskill(sd,BS_HILTBINDING)>0)
tick += tick / 10;
break;
case SC_CONCENTRATION:
@@ -7889,7 +7890,7 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val
int pos = (bl->x&0xFFFF)|(bl->y<<16), //Current Coordinates
map = sd->mapindex; //Current Map
//1. Place in Jail (val2 -> Jail Map, val3 -> x, val4 -> y
- iPc->setpos(sd,(unsigned short)val2,val3,val4, CLR_TELEPORT);
+ pc->setpos(sd,(unsigned short)val2,val3,val4, CLR_TELEPORT);
//2. Set restore point (val3 -> return map, val4 return coords
val3 = map;
val4 = pos;
@@ -8033,7 +8034,7 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val
break;
case SC_STONEHARDSKIN:
if( sd )
- val1 = sd->status.job_level * iPc->checkskill(sd, RK_RUNEMASTERY) / 4; //DEF/MDEF Increase
+ val1 = sd->status.job_level * pc->checkskill(sd, RK_RUNEMASTERY) / 4; //DEF/MDEF Increase
break;
case SC_FIGHTINGSPIRIT:
val_flag |= 1|2;
@@ -8181,18 +8182,18 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val
case SC__ENERVATION:
val2 = 20 + 10 * val1; // ATK Reduction
val_flag |= 1|2;
- if( sd ) iPc->delspiritball(sd,sd->spiritball,0);
+ if( sd ) pc->delspiritball(sd,sd->spiritball,0);
break;
case SC__GROOMY:
val2 = 20 + 10 * val1; //ASPD. Need to confirm if Movement Speed reduction is the same. [Jobbie]
val3 = 20 * val1; //HIT
val_flag |= 1|2|4;
if( sd ) { // Removes Animals
- if( pc_isriding(sd) ) iPc->setriding(sd, 0);
- if( pc_isridingdragon(sd) ) iPc->setoption(sd, sd->sc.option&~OPTION_DRAGON);
- if( pc_iswug(sd) ) iPc->setoption(sd, sd->sc.option&~OPTION_WUG);
- if( pc_isridingwug(sd) ) iPc->setoption(sd, sd->sc.option&~OPTION_WUGRIDER);
- if( pc_isfalcon(sd) ) iPc->setoption(sd, sd->sc.option&~OPTION_FALCON);
+ if( pc_isriding(sd) ) pc->setriding(sd, 0);
+ if( pc_isridingdragon(sd) ) pc->setoption(sd, sd->sc.option&~OPTION_DRAGON);
+ if( pc_iswug(sd) ) pc->setoption(sd, sd->sc.option&~OPTION_WUG);
+ if( pc_isridingwug(sd) ) pc->setoption(sd, sd->sc.option&~OPTION_WUGRIDER);
+ if( pc_isfalcon(sd) ) pc->setoption(sd, sd->sc.option&~OPTION_FALCON);
if( sd->status.pet_id > 0 ) pet_menu(sd, 3);
if( homun_alive(sd->hd) ) homun->vaporize(sd,1);
if( sd->md ) merc_delete(sd->md,3);
@@ -8292,13 +8293,13 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val
val3 = 15 + 5 * val1; // ASPD reduction.
if( sd && rand()%100 < val1 ){ // (Skill Lv) %
val4 = 1; // reduce walk speed by half.
- if( pc_isriding(sd) ) iPc->setriding(sd, 0);
- if( pc_isridingdragon(sd) ) iPc->setoption(sd, sd->sc.option&~OPTION_DRAGON);
+ if( pc_isriding(sd) ) pc->setriding(sd, 0);
+ if( pc_isridingdragon(sd) ) pc->setoption(sd, sd->sc.option&~OPTION_DRAGON);
}
break;
case SC_GLOOMYDAY_SK:
// Random number between [15 ~ (Voice Lesson Skill Level x 5) + (Skill Level x 10)] %.
- val2 = 15 + rand()%( (sd?iPc->checkskill(sd, WM_LESSON)*5:0) + val1*10 );
+ val2 = 15 + rand()%( (sd?pc->checkskill(sd, WM_LESSON)*5:0) + val1*10 );
break;
case SC_SITDOWN_FORCE:
case SC_BANANA_BOMB_SITDOWN:
@@ -8355,7 +8356,7 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val
val2 = ((status->int_ + status->luk) / 6) + 5; // Chance to evade magic damage.
val1 *= 15; // Defence added
if( sd )
- val1 += 10 * iPc->checkskill(sd,CR_DEFENDER);
+ val1 += 10 * pc->checkskill(sd,CR_DEFENDER);
val_flag |= 1|2;
break;
case SC_BANDING:
@@ -8643,7 +8644,7 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val
case SC_STONE:
case SC_DEEPSLEEP:
if (sd && pc_issit(sd)) //Avoid sprite sync problems.
- iPc->setstand(sd);
+ pc->setstand(sd);
case SC_TRICKDEAD:
status_change_end(bl, SC_DANCING, INVALID_TIMER);
// Cancel cast when get status [LuzZza]
@@ -8964,7 +8965,7 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val
clif->skillinfo(sd,TK_JUMPKICK, INF_SELF_SKILL);
break;
case MO_TRIPLEATTACK:
- if (sd && iPc->checkskill(sd, SR_DRAGONCOMBO) > 0)
+ if (sd && pc->checkskill(sd, SR_DRAGONCOMBO) > 0)
clif->skillinfo(sd,SR_DRAGONCOMBO, INF_SELF_SKILL);
break;
case SR_FALLENEMPIRE:
@@ -9360,7 +9361,7 @@ int status_change_end_(struct block_list* bl, enum sc_type type, int tid, const
clif->skillinfo(sd, TK_JUMPKICK, 0);
break;
case MO_TRIPLEATTACK:
- if (iPc->checkskill(sd, SR_DRAGONCOMBO) > 0)
+ if (pc->checkskill(sd, SR_DRAGONCOMBO) > 0)
clif->skillinfo(sd, SR_DRAGONCOMBO, 0);
break;
case SR_FALLENEMPIRE:
@@ -9437,7 +9438,7 @@ int status_change_end_(struct block_list* bl, enum sc_type type, int tid, const
break;
//natural expiration.
if(sd && sd->mapindex == sce->val2)
- iPc->setpos(sd,(unsigned short)sce->val3,sce->val4&0xFFFF, sce->val4>>16, CLR_TELEPORT);
+ pc->setpos(sd,(unsigned short)sce->val3,sce->val4&0xFFFF, sce->val4>>16, CLR_TELEPORT);
break; //guess hes not in jail :P
case SC_CHANGE:
if (tid == INVALID_TIMER)
@@ -9504,7 +9505,7 @@ int status_change_end_(struct block_list* bl, enum sc_type type, int tid, const
break;
case SC_SITDOWN_FORCE:
if( sd && pc_issit(sd) ) {
- iPc->setstand(sd);
+ pc->setstand(sd);
clif->standing(bl);
}
break;
@@ -9533,10 +9534,10 @@ int status_change_end_(struct block_list* bl, enum sc_type type, int tid, const
if( sd && sce->val2 && !pc_isdead(sd) ) {
int i;
i = min(sd->spiritball,5);
- iPc->delspiritball(sd, sd->spiritball, 0);
+ pc->delspiritball(sd, sd->spiritball, 0);
status_change_end(bl, SC_EXPLOSIONSPIRITS, INVALID_TIMER);
while( i > 0 ) {
- iPc->addspiritball(sd, skill->get_time(MO_CALLSPIRITS, iPc->checkskill(sd,MO_CALLSPIRITS)), 5);
+ pc->addspiritball(sd, skill->get_time(MO_CALLSPIRITS, pc->checkskill(sd,MO_CALLSPIRITS)), 5);
--i;
}
}
@@ -9963,7 +9964,7 @@ int status_change_timer(int tid, unsigned int tick, int id, intptr_t data)
if(bl->m == sd->feel_map[0].m ||
bl->m == sd->feel_map[1].m ||
bl->m == sd->feel_map[2].m)
- { //Timeout will be handled by iPc->setpos
+ { //Timeout will be handled by pc->setpos
sce->timer = INVALID_TIMER;
return 0;
}
@@ -10482,7 +10483,7 @@ int status_change_timer(int tid, unsigned int tick, int id, intptr_t data)
case SC_BANDING:
if( status_charge(bl, 0, 7 - sce->val1) )
{
- if( sd ) iPc->banding(sd, sce->val1);
+ if( sd ) pc->banding(sd, sce->val1);
sc_timer_next(5000 + tick, status_change_timer, bl->id, data);
return 0;
}
@@ -10961,9 +10962,9 @@ static int status_natural_heal(struct block_list* bl, va_list args)
if (sd) {
if (sd->hp_loss.value || sd->sp_loss.value)
- iPc->bleeding(sd, natural_heal_diff_tick);
+ pc->bleeding(sd, natural_heal_diff_tick);
if (sd->hp_regen.value || sd->sp_regen.value)
- iPc->regen(sd, natural_heal_diff_tick);
+ pc->regen(sd, natural_heal_diff_tick);
}
if(flag&(RGN_SHP|RGN_SSP) && regen->ssregen &&
@@ -11098,7 +11099,7 @@ static int status_natural_heal(struct block_list* bl, va_list args)
if (sd && sd->state.doridori) {
val*=2;
sd->state.doridori = 0;
- if ((rate = iPc->checkskill(sd,TK_SPTIME)))
+ if ((rate = pc->checkskill(sd,TK_SPTIME)))
sc_start(bl,status_skill2sc(TK_SPTIME),
100,rate,skill->get_time(TK_SPTIME, rate));
if (
@@ -11106,8 +11107,8 @@ static int status_natural_heal(struct block_list* bl, va_list args)
rnd()%10000 < battle_config.sg_angel_skill_ratio
) { //Angel of the Sun/Moon/Star
clif->feel_hate_reset(sd);
- iPc->resethate(sd);
- iPc->resetfeel(sd);
+ pc->resethate(sd);
+ pc->resetfeel(sd);
}
}
sregen->tick.sp -= battle_config.natural_heal_skill_interval;
@@ -11161,7 +11162,7 @@ static bool status_readdb_job1(char* fields[], int columns, int current)
ShowWarning("status_readdb_job1: Invalid job class %d specified.\n", class_);
return false;
}
- idx = iPc->class2idx(class_);
+ idx = pc->class2idx(class_);
max_weight_base[idx] = atoi(fields[1]);
hp_coefficient[idx] = atoi(fields[2]);
@@ -11189,7 +11190,7 @@ static bool status_readdb_job2(char* fields[], int columns, int current)
ShowWarning("status_readdb_job2: Invalid job class %d specified.\n", class_);
return false;
}
- idx = iPc->class2idx(class_);
+ idx = pc->class2idx(class_);
for(i = 1; i < columns; i++)
{
diff --git a/src/map/storage.c b/src/map/storage.c
index 188534b61..ea30f6c0f 100644
--- a/src/map/storage.c
+++ b/src/map/storage.c
@@ -73,7 +73,7 @@ void do_final_storage(void) // by [MC Cameri]
*/
static int storage_reconnect_sub(DBKey key, DBData *data, va_list ap)
{
- struct guild_storage *stor = iDB->data2ptr(data);
+ struct guild_storage *stor = DB->data2ptr(data);
if (stor->dirty && stor->storage_status == 0) //Save closed storages.
storage_guild_storagesave(0, stor->guild_id,0);
@@ -98,7 +98,7 @@ int storage_storageopen(struct map_session_data *sd)
if(sd->state.storage_flag)
return 1; //Already open?
- if( !iPc->can_give_items(sd) )
+ if( !pc->can_give_items(sd) )
{ //check is this GM level is allowed to put items to storage
clif->message(sd->fd, msg_txt(246));
return 1;
@@ -148,7 +148,7 @@ static int storage_additem(struct map_session_data* sd, struct item* item_data,
return 1;
}
- if( !itemdb_canstore(item_data, iPc->get_group_level(sd)) )
+ if( !itemdb_canstore(item_data, pc->get_group_level(sd)) )
{ //Check if item is storable. [Skotlex]
clif->message (sd->fd, msg_txt(264));
return 1;
@@ -227,7 +227,7 @@ int storage_storageadd(struct map_session_data* sd, int index, int amount)
return 0;
if( storage_additem(sd,&sd->status.inventory[index],amount) == 0 )
- iPc->delitem(sd,index,amount,0,4,LOG_TYPE_STORAGE);
+ pc->delitem(sd,index,amount,0,4,LOG_TYPE_STORAGE);
return 1;
}
@@ -252,7 +252,7 @@ int storage_storageget(struct map_session_data* sd, int index, int amount)
if( amount < 1 || amount > sd->status.storage.items[index].amount )
return 0;
- if( (flag = iPc->additem(sd,&sd->status.storage.items[index],amount,LOG_TYPE_STORAGE)) == 0 )
+ if( (flag = pc->additem(sd,&sd->status.storage.items[index],amount,LOG_TYPE_STORAGE)) == 0 )
storage_delitem(sd,index,amount);
else
clif->additem(sd,0,0,flag);
@@ -284,7 +284,7 @@ int storage_storageaddfromcart(struct map_session_data* sd, int index, int amoun
return 0;
if( storage_additem(sd,&sd->status.cart[index],amount) == 0 )
- iPc->cart_delitem(sd,index,amount,0,LOG_TYPE_STORAGE);
+ pc->cart_delitem(sd,index,amount,0,LOG_TYPE_STORAGE);
return 1;
}
@@ -309,7 +309,7 @@ int storage_storagegettocart(struct map_session_data* sd, int index, int amount)
if( amount < 1 || amount > sd->status.storage.items[index].amount )
return 0;
- if( iPc->cart_additem(sd,&sd->status.storage.items[index],amount,LOG_TYPE_STORAGE) == 0 )
+ if( pc->cart_additem(sd,&sd->status.storage.items[index],amount,LOG_TYPE_STORAGE) == 0 )
storage_delitem(sd,index,amount);
return 1;
@@ -352,7 +352,7 @@ static DBData create_guildstorage(DBKey key, va_list args)
struct guild_storage *gs = NULL;
gs = (struct guild_storage *) aCalloc(sizeof(struct guild_storage), 1);
gs->guild_id=key.i;
- return iDB->ptr2data(gs);
+ return DB->ptr2data(gs);
}
struct guild_storage *guild2storage(int guild_id)
@@ -394,7 +394,7 @@ int storage_guild_storageopen(struct map_session_data* sd)
if(sd->state.storage_flag)
return 1; //Can't open both storages at a time.
- if( !iPc->can_give_items(sd) ) { //check is this GM level can open guild storage and store items [Lupus]
+ if( !pc->can_give_items(sd) ) { //check is this GM level can open guild storage and store items [Lupus]
clif->message(sd->fd, msg_txt(246));
return 1;
}
@@ -442,7 +442,7 @@ int guild_storage_additem(struct map_session_data* sd, struct guild_storage* sto
return 1;
}
- if( !itemdb_canguildstore(item_data, iPc->get_group_level(sd)) || item_data->expire_time )
+ if( !itemdb_canguildstore(item_data, pc->get_group_level(sd)) || item_data->expire_time )
{ //Check if item is storable. [Skotlex]
clif->message (sd->fd, msg_txt(264));
return 1;
@@ -532,7 +532,7 @@ int storage_guild_storageadd(struct map_session_data* sd, int index, int amount)
}
if(guild_storage_additem(sd,stor,&sd->status.inventory[index],amount)==0)
- iPc->delitem(sd,index,amount,0,4,LOG_TYPE_GSTORAGE);
+ pc->delitem(sd,index,amount,0,4,LOG_TYPE_GSTORAGE);
return 1;
}
@@ -569,7 +569,7 @@ int storage_guild_storageget(struct map_session_data* sd, int index, int amount)
return 0;
}
- if((flag = iPc->additem(sd,&stor->items[index],amount,LOG_TYPE_GSTORAGE)) == 0)
+ if((flag = pc->additem(sd,&stor->items[index],amount,LOG_TYPE_GSTORAGE)) == 0)
guild_storage_delitem(sd,stor,index,amount);
else //inform fail
clif->additem(sd,0,0,flag);
@@ -605,7 +605,7 @@ int storage_guild_storageaddfromcart(struct map_session_data* sd, int index, int
return 0;
if(guild_storage_additem(sd,stor,&sd->status.cart[index],amount)==0)
- iPc->cart_delitem(sd,index,amount,0,LOG_TYPE_GSTORAGE);
+ pc->cart_delitem(sd,index,amount,0,LOG_TYPE_GSTORAGE);
return 1;
}
@@ -636,7 +636,7 @@ int storage_guild_storagegettocart(struct map_session_data* sd, int index, int a
if(amount < 1 || amount > stor->items[index].amount)
return 0;
- if(iPc->cart_additem(sd,&stor->items[index],amount,LOG_TYPE_GSTORAGE)==0)
+ if(pc->cart_additem(sd,&stor->items[index],amount,LOG_TYPE_GSTORAGE)==0)
guild_storage_delitem(sd,stor,index,amount);
return 1;
diff --git a/src/map/trade.c b/src/map/trade.c
index 4f4cc7394..8311dbf3d 100644
--- a/src/map/trade.c
+++ b/src/map/trade.c
@@ -69,7 +69,7 @@ void trade_traderequest(struct map_session_data *sd, struct map_session_data *ta
return;
}
- if (!iPc->can_give_items(sd) || !iPc->can_give_items(target_sd)) //check if both GMs are allowed to trade
+ if (!pc->can_give_items(sd) || !pc->can_give_items(target_sd)) //check if both GMs are allowed to trade
{
clif->message(sd->fd, msg_txt(246));
clif->tradestart(sd, 2); // GM is not allowed to trade
@@ -77,7 +77,7 @@ void trade_traderequest(struct map_session_data *sd, struct map_session_data *ta
}
// Players can not request trade from far away, unless they are allowed to use @trade.
- if (!iPc->can_use_command(sd, "@trade") &&
+ if (!pc->can_use_command(sd, "@trade") &&
(sd->bl.m != target_sd->bl.m || !check_distance_bl(&sd->bl, &target_sd->bl, TRADE_DISTANCE))) {
clif->tradestart(sd, 0); // too far
return ;
@@ -135,7 +135,7 @@ void trade_tradeack(struct map_session_data *sd, int type)
// Players can not request trade from far away, unless they are allowed to use @trade.
// Check here as well since the original character could had warped.
- if (!iPc->can_use_command(sd, "@trade") &&
+ if (!pc->can_use_command(sd, "@trade") &&
(sd->bl.m != tsd->bl.m || !check_distance_bl(&sd->bl, &tsd->bl, TRADE_DISTANCE))) {
clif->tradestart(sd, 0); // too far
sd->trade_partner=0;
@@ -350,10 +350,10 @@ void trade_tradeadditem(struct map_session_data *sd, short index, short amount)
return;
item = &sd->status.inventory[index];
- src_lv = iPc->get_group_level(sd);
- dst_lv = iPc->get_group_level(target_sd);
+ src_lv = pc->get_group_level(sd);
+ dst_lv = pc->get_group_level(target_sd);
if( !itemdb_cantrade(item, src_lv, dst_lv) && //Can't trade
- (iPc->get_partner(sd) != target_sd || !itemdb_canpartnertrade(item, src_lv, dst_lv)) ) //Can't partner-trade
+ (pc->get_partner(sd) != target_sd || !itemdb_canpartnertrade(item, src_lv, dst_lv)) ) //Can't partner-trade
{
clif->message (sd->fd, msg_txt(260));
clif->tradeitemok(sd, index+2, 1);
@@ -555,9 +555,9 @@ void trade_tradecommit(struct map_session_data *sd)
{
n = sd->deal.item[trade_i].index;
- flag = iPc->additem(tsd, &sd->status.inventory[n], sd->deal.item[trade_i].amount,LOG_TYPE_TRADE);
+ flag = pc->additem(tsd, &sd->status.inventory[n], sd->deal.item[trade_i].amount,LOG_TYPE_TRADE);
if (flag == 0)
- iPc->delitem(sd, n, sd->deal.item[trade_i].amount, 1, 6, LOG_TYPE_TRADE);
+ pc->delitem(sd, n, sd->deal.item[trade_i].amount, 1, 6, LOG_TYPE_TRADE);
else
clif->additem(sd, n, sd->deal.item[trade_i].amount, 0);
sd->deal.item[trade_i].index = 0;
@@ -567,9 +567,9 @@ void trade_tradecommit(struct map_session_data *sd)
{
n = tsd->deal.item[trade_i].index;
- flag = iPc->additem(sd, &tsd->status.inventory[n], tsd->deal.item[trade_i].amount,LOG_TYPE_TRADE);
+ flag = pc->additem(sd, &tsd->status.inventory[n], tsd->deal.item[trade_i].amount,LOG_TYPE_TRADE);
if (flag == 0)
- iPc->delitem(tsd, n, tsd->deal.item[trade_i].amount, 1, 6, LOG_TYPE_TRADE);
+ pc->delitem(tsd, n, tsd->deal.item[trade_i].amount, 1, 6, LOG_TYPE_TRADE);
else
clif->additem(tsd, n, tsd->deal.item[trade_i].amount, 0);
tsd->deal.item[trade_i].index = 0;
@@ -578,14 +578,14 @@ void trade_tradecommit(struct map_session_data *sd)
}
if( sd->deal.zeny ) {
- iPc->payzeny(sd ,sd->deal.zeny, LOG_TYPE_TRADE, tsd);
- iPc->getzeny(tsd,sd->deal.zeny,LOG_TYPE_TRADE, sd);
+ pc->payzeny(sd ,sd->deal.zeny, LOG_TYPE_TRADE, tsd);
+ pc->getzeny(tsd,sd->deal.zeny,LOG_TYPE_TRADE, sd);
sd->deal.zeny = 0;
}
if ( tsd->deal.zeny) {
- iPc->payzeny(tsd,tsd->deal.zeny,LOG_TYPE_TRADE, sd);
- iPc->getzeny(sd ,tsd->deal.zeny,LOG_TYPE_TRADE, tsd);
+ pc->payzeny(tsd,tsd->deal.zeny,LOG_TYPE_TRADE, sd);
+ pc->getzeny(sd ,tsd->deal.zeny,LOG_TYPE_TRADE, tsd);
tsd->deal.zeny = 0;
}
diff --git a/src/map/unit.c b/src/map/unit.c
index a09776298..153ef5eda 100644
--- a/src/map/unit.c
+++ b/src/map/unit.c
@@ -754,7 +754,7 @@ int unit_blown(struct block_list* bl, int dx, int dy, int count, int flag)
}
//Warps a unit/ud to a given map/position.
-//In the case of players, iPc->setpos is used.
+//In the case of players, pc->setpos is used.
//it respects the no warp flags, so it is safe to call this without doing nowarpto/nowarp checks.
int unit_warp(struct block_list *bl,short m,short x,short y,clr_type type)
{
@@ -804,7 +804,7 @@ int unit_warp(struct block_list *bl,short m,short x,short y,clr_type type)
}
if (bl->type == BL_PC) //Use pc_setpos
- return iPc->setpos((TBL_PC*)bl, map_id2index(m), x, y, type);
+ return pc->setpos((TBL_PC*)bl, map_id2index(m), x, y, type);
if (!unit_remove_map(bl, type))
return 3;
@@ -908,7 +908,7 @@ int unit_can_move(struct block_list *bl) {
if (!ud)
return 0;
- if (ud->skilltimer != INVALID_TIMER && ud->skill_id != LG_EXEEDBREAK && (!sd || !iPc->checkskill(sd, SA_FREECAST) || skill->get_inf2(ud->skill_id)&INF2_GUILD_SKILL))
+ if (ud->skilltimer != INVALID_TIMER && ud->skill_id != LG_EXEEDBREAK && (!sd || !pc->checkskill(sd, SA_FREECAST) || skill->get_inf2(ud->skill_id)&INF2_GUILD_SKILL))
return 0; // prevent moving while casting
if (DIFF_TICK(ud->canmove_tick, iTimer->gettick()) > 0)
@@ -968,7 +968,7 @@ int unit_can_move(struct block_list *bl) {
if (sc->opt1 > 0 && sc->opt1 != OPT1_STONEWAIT && sc->opt1 != OPT1_BURNING && !(sc->opt1 == OPT1_CRYSTALIZE && bl->type == BL_MOB))
return 0;
- if ((sc->option & OPTION_HIDE) && (!sd || iPc->checkskill(sd, RG_TUNNELDRIVE) <= 0))
+ if ((sc->option & OPTION_HIDE) && (!sd || pc->checkskill(sd, RG_TUNNELDRIVE) <= 0))
return 0;
}
@@ -1162,7 +1162,7 @@ int unit_skilluse_id2(struct block_list *src, int target_id, uint16 skill_id, ui
break;
case BD_ENCORE:
//Prevent using the dance skill if you no longer have the skill in your tree.
- if(!sd->skill_id_dance || iPc->checkskill(sd,sd->skill_id_dance)<=0){
+ if(!sd->skill_id_dance || pc->checkskill(sd,sd->skill_id_dance)<=0){
clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0);
return 0;
}
@@ -1277,7 +1277,7 @@ int unit_skilluse_id2(struct block_list *src, int target_id, uint16 skill_id, ui
}
break;
case GD_EMERGENCYCALL: //Emergency Call double cast when the user has learned Leap [Daegaladh]
- if( sd && iPc->checkskill(sd,TK_HIGHJUMP) )
+ if( sd && pc->checkskill(sd,TK_HIGHJUMP) )
casttime *= 2;
break;
case RA_WUGDASH:
@@ -1386,7 +1386,7 @@ int unit_skilluse_id2(struct block_list *src, int target_id, uint16 skill_id, ui
if( casttime > 0 ) {
ud->skilltimer = iTimer->add_timer( tick+casttime, skill->castend_id, src->id, 0 );
- if( sd && (iPc->checkskill(sd,SA_FREECAST) > 0 || skill_id == LG_EXEEDBREAK) )
+ if( sd && (pc->checkskill(sd,SA_FREECAST) > 0 || skill_id == LG_EXEEDBREAK) )
status_calc_bl(&sd->bl, SCB_SPEED);
} else
skill->castend_id(ud->skilltimer,tick,src->id,0);
@@ -1517,7 +1517,7 @@ int unit_skilluse_pos2( struct block_list *src, short skill_x, short skill_y, ui
clif->skillcasting(src, src->id, 0, skill_x, skill_y, skill_id, skill->get_ele(skill_id, skill_lv), casttime);
if( casttime > 0 ) {
ud->skilltimer = iTimer->add_timer( tick+casttime, skill->castend_pos, src->id, 0 );
- if( (sd && iPc->checkskill(sd,SA_FREECAST) > 0) || skill_id == LG_EXEEDBREAK)
+ if( (sd && pc->checkskill(sd,SA_FREECAST) > 0) || skill_id == LG_EXEEDBREAK)
status_calc_bl(&sd->bl, SCB_SPEED);
} else {
ud->skilltimer = INVALID_TIMER;
@@ -1804,10 +1804,10 @@ static int unit_attack_timer_sub(struct block_list* src, int tid, unsigned int t
return 0;
}
- if( ud->skilltimer != INVALID_TIMER && !(sd && iPc->checkskill(sd,SA_FREECAST) > 0) )
+ if( ud->skilltimer != INVALID_TIMER && !(sd && pc->checkskill(sd,SA_FREECAST) > 0) )
return 0; // can't attack while casting
- if( !battle_config.sdelay_attack_enable && DIFF_TICK(ud->canact_tick,tick) > 0 && !(sd && iPc->checkskill(sd,SA_FREECAST) > 0) )
+ if( !battle_config.sdelay_attack_enable && DIFF_TICK(ud->canact_tick,tick) > 0 && !(sd && pc->checkskill(sd,SA_FREECAST) > 0) )
{ // attacking when under cast delay has restrictions:
if( tid == INVALID_TIMER )
{ //requested attack.
@@ -1945,7 +1945,7 @@ int unit_skillcastcancel(struct block_list *bl,int type)
ud->skilltimer = INVALID_TIMER;
- if( sd && iPc->checkskill(sd,SA_FREECAST) > 0 )
+ if( sd && pc->checkskill(sd,SA_FREECAST) > 0 )
status_calc_bl(&sd->bl, SCB_SPEED);
if( sd ) {
@@ -2111,7 +2111,7 @@ int unit_remove_map_(struct block_list *bl, clr_type clrtype, const char* file,
storage_guild_storage_quit(sd,0);
sd->state.storage_flag = 0; //Force close it when being warped.
if(sd->party_invite>0)
- iParty->reply_invite(sd,sd->party_invite,0);
+ party->reply_invite(sd,sd->party_invite,0);
if(sd->guild_invite>0)
guild->reply_invite(sd,sd->guild_invite,0);
if(sd->guild_alliance>0)
@@ -2131,7 +2131,7 @@ int unit_remove_map_(struct block_list *bl, clr_type clrtype, const char* file,
sd->adopt_invite = 0;
if(sd->pvp_timer != INVALID_TIMER) {
- iTimer->delete_timer(sd->pvp_timer,iPc->calc_pvprank_timer);
+ iTimer->delete_timer(sd->pvp_timer,pc->calc_pvprank_timer);
sd->pvp_timer = INVALID_TIMER;
sd->pvp_rank = 0;
}
@@ -2139,10 +2139,10 @@ int unit_remove_map_(struct block_list *bl, clr_type clrtype, const char* file,
duel_leave(sd->duel_group, sd);
if(pc_issit(sd)) {
- iPc->setstand(sd);
+ pc->setstand(sd);
skill->sit(sd,0);
}
- iParty->send_dot_remove(sd);//minimap dot fix [Kevin]
+ party->send_dot_remove(sd);//minimap dot fix [Kevin]
guild->send_dot_remove(sd);
bg_send_dot_remove(sd);
@@ -2301,28 +2301,28 @@ int unit_free(struct block_list *bl, clr_type clrtype)
int i;
if( status_isdead(bl) )
- iPc->setrestartvalue(sd,2);
+ pc->setrestartvalue(sd,2);
- iPc->delinvincibletimer(sd);
- iPc->delautobonus(sd,sd->autobonus,ARRAYLENGTH(sd->autobonus),false);
- iPc->delautobonus(sd,sd->autobonus2,ARRAYLENGTH(sd->autobonus2),false);
- iPc->delautobonus(sd,sd->autobonus3,ARRAYLENGTH(sd->autobonus3),false);
+ pc->delinvincibletimer(sd);
+ pc->delautobonus(sd,sd->autobonus,ARRAYLENGTH(sd->autobonus),false);
+ pc->delautobonus(sd,sd->autobonus2,ARRAYLENGTH(sd->autobonus2),false);
+ pc->delautobonus(sd,sd->autobonus3,ARRAYLENGTH(sd->autobonus3),false);
if( sd->followtimer != INVALID_TIMER )
- iPc->stop_following(sd);
+ pc->stop_following(sd);
if( sd->duel_invite > 0 )
duel_reject(sd->duel_invite, sd);
// Notify friends that this char logged out. [Skotlex]
iMap->map_foreachpc(clif->friendslist_toggle_sub, sd->status.account_id, sd->status.char_id, 0);
- iParty->send_logout(sd);
+ party->send_logout(sd);
guild->send_memberinfoshort(sd,0);
- iPc->cleareventtimer(sd);
- iPc->inventory_rental_clear(sd);
- iPc->delspiritball(sd,sd->spiritball,1);
+ pc->cleareventtimer(sd);
+ pc->inventory_rental_clear(sd);
+ pc->delspiritball(sd,sd->spiritball,1);
for(i = 1; i < 5; i++)
- iPc->del_talisman(sd, sd->talisman[i], i);
+ pc->del_talisman(sd, sd->talisman[i], i);
if( sd->reg ) { //Double logout already freed pointer fix... [Skotlex]
aFree(sd->reg);
diff --git a/src/map/vending.c b/src/map/vending.c
index 5b0bfdaa5..e0dd844e1 100644
--- a/src/map/vending.c
+++ b/src/map/vending.c
@@ -51,7 +51,7 @@ void vending_vendinglistreq(struct map_session_data* sd, unsigned int id) {
if( !vsd->state.vending )
return; // not vending
- if (!iPc->can_give_items(sd) || !iPc->can_give_items(vsd)) { //check if both GMs are allowed to trade
+ if (!pc->can_give_items(sd) || !pc->can_give_items(vsd)) { //check if both GMs are allowed to trade
// GM is not allowed to trade
clif->message(sd->fd, msg_txt(246));
return;
@@ -88,7 +88,7 @@ void vending_purchasereq(struct map_session_data* sd, int aid, unsigned int uid,
if( count < 1 || count > MAX_VENDING || count > vsd->vend_num )
return; // invalid amount of purchased items
- blank = iPc->inventoryblank(sd); //number of free cells in the buyer's inventory
+ blank = pc->inventoryblank(sd); //number of free cells in the buyer's inventory
// duplicate item in vending to check hacker with multiple packets
memcpy(&vend, &vsd->vending, sizeof(vsd->vending)); // copy vending list
@@ -144,7 +144,7 @@ void vending_purchasereq(struct map_session_data* sd, int aid, unsigned int uid,
vend[j].amount -= amount;
- switch( iPc->checkadditem(sd, vsd->status.cart[idx].nameid, amount) ) {
+ switch( pc->checkadditem(sd, vsd->status.cart[idx].nameid, amount) ) {
case ADDITEM_EXIST:
break; //We'd add this item to the existing one (in buyers inventory)
case ADDITEM_NEW:
@@ -157,10 +157,10 @@ void vending_purchasereq(struct map_session_data* sd, int aid, unsigned int uid,
}
}
- iPc->payzeny(sd, (int)z, LOG_TYPE_VENDING, vsd);
+ pc->payzeny(sd, (int)z, LOG_TYPE_VENDING, vsd);
if( battle_config.vending_tax )
z -= z * (battle_config.vending_tax/10000.);
- iPc->getzeny(vsd, (int)z, LOG_TYPE_VENDING, sd);
+ pc->getzeny(vsd, (int)z, LOG_TYPE_VENDING, sd);
for( i = 0; i < count; i++ ) {
short amount = *(uint16*)(data + 4*i + 0);
@@ -168,9 +168,9 @@ void vending_purchasereq(struct map_session_data* sd, int aid, unsigned int uid,
idx -= 2;
// vending item
- iPc->additem(sd, &vsd->status.cart[idx], amount, LOG_TYPE_VENDING);
+ pc->additem(sd, &vsd->status.cart[idx], amount, LOG_TYPE_VENDING);
vsd->vending[vend_list[i]].amount -= amount;
- iPc->cart_delitem(vsd, idx, amount, 0, LOG_TYPE_VENDING);
+ pc->cart_delitem(vsd, idx, amount, 0, LOG_TYPE_VENDING);
clif->vendingreport(vsd, idx, amount);
//print buyer's name
@@ -226,7 +226,7 @@ void vending_openvending(struct map_session_data* sd, const char* message, const
if ( pc_isdead(sd) || !sd->state.prevend || pc_istrading(sd))
return; // can't open vendings lying dead || didn't use via the skill (wpe/hack) || can't have 2 shops at once
- vending_skill_lvl = iPc->checkskill(sd, MC_VENDING);
+ vending_skill_lvl = pc->checkskill(sd, MC_VENDING);
// skill level and cart check
if( !vending_skill_lvl || !pc_iscarton(sd) ) {
clif->skill_fail(sd, MC_VENDING, USESKILL_FAIL_LEVEL, 0);
@@ -250,12 +250,12 @@ void vending_openvending(struct map_session_data* sd, const char* message, const
index -= 2; // offset adjustment (client says that the first cart position is 2)
if( index < 0 || index >= MAX_CART // invalid position
- || iPc->cartitem_amount(sd, index, amount) < 0 // invalid item or insufficient quantity
+ || pc->cartitem_amount(sd, index, amount) < 0 // invalid item or insufficient quantity
//NOTE: official server does not do any of the following checks!
|| !sd->status.cart[index].identify // unidentified item
|| sd->status.cart[index].attribute == 1 // broken item
|| sd->status.cart[index].expire_time // It should not be in the cart but just in case
- || !itemdb_cantrade(&sd->status.cart[index], iPc->get_group_level(sd), iPc->get_group_level(sd)) ) // untradeable item
+ || !itemdb_cantrade(&sd->status.cart[index], pc->get_group_level(sd), pc->get_group_level(sd)) ) // untradeable item
continue;
sd->vending[i].index = index;