From ca025dac06d37eb96ce4fae6d5ee75cbbba63941 Mon Sep 17 00:00:00 2001 From: Cydh Ramdh Date: Sat, 23 Jun 2018 06:04:50 +0700 Subject: [PATCH 01/11] Random options support & Vending rework * Added random option info in inventory, cart, and storage. If item has options, it'll show as [n Options] in default theme, collapsible. * Random option feature can be disabled in application.php for backward compatibility * Vending & buyingstore have item listing as default, listing by shop name is now in different page: vendors & buyers * Recolor item price for vending & buyingstore * Moved item bound message to label * Added new library Flux/Item to reduce redundant codes after item fetching * Fixes #190, renewed card0 special values and added into config in application.php for backward compatibility --- config/access.php | 14 +- config/application.php | 33 +++- config/randomoption_ids.php | 195 ++++++++++++++++++++ config/randomoptions.php | 192 ++++++++++++++++++++ lang/en_us.php | 6 + lib/Flux.php | 41 +++++ lib/Flux/Item.php | 189 +++++++++++++++++++ lib/Flux/Template.php | 43 +++++ modules/account/view.php | 92 ++++------ modules/buyingstore/buyers.php | 51 ++++++ modules/buyingstore/index.php | 57 ++++-- modules/buyingstore/viewshop.php | 4 +- modules/character/view.php | 96 +++------- modules/vending/index.php | 108 +++++++++-- modules/vending/vendors.php | 51 ++++++ modules/vending/viewshop.php | 62 ++----- themes/bootstrap/css/flux.css | 12 ++ themes/bootstrap/footer.php | 1 + themes/default/account/view.php | 106 ++++------- themes/default/buyingstore/buyers.php | 86 +++++++++ themes/default/buyingstore/index.php | 78 ++++---- themes/default/buyingstore/viewshop.php | 25 ++- themes/default/character/view.php | 102 +++++------ themes/default/css/flux.css | 73 ++++++++ themes/default/footer.php | 1 + themes/default/header.php | 1 + themes/default/vending/index.php | 204 +++++++++++++++------ themes/default/vending/vendors.php | 87 +++++++++ themes/default/vending/viewshop.php | 231 +++++++++++------------- 29 files changed, 1657 insertions(+), 584 deletions(-) create mode 100644 config/randomoption_ids.php create mode 100644 config/randomoptions.php create mode 100644 lib/Flux/Item.php create mode 100644 modules/buyingstore/buyers.php create mode 100644 modules/vending/vendors.php create mode 100644 themes/default/buyingstore/buyers.php create mode 100644 themes/default/vending/vendors.php diff --git a/config/access.php b/config/access.php index 5d8fa23d..35606769 100644 --- a/config/access.php +++ b/config/access.php @@ -198,10 +198,16 @@ 'staffsettings' => AccountLevel::LOWGM, 'catcontrol' => AccountLevel::HIGHGM ), - 'vending' => array( - 'index' => AccountLevel::ANYONE, - 'viewshop' => AccountLevel::ANYONE, - ), + 'vending' => array( + 'index' => AccountLevel::ANYONE, + 'vendors' => AccountLevel::ANYONE, + 'viewshop' => AccountLevel::ANYONE, + ), + 'buyingstore' => array( + 'index' => AccountLevel::ANYONE, + 'buyers' => AccountLevel::ANYONE, + 'viewshop' => AccountLevel::ANYONE, + ), 'webcommands' => array( 'index' => AccountLevel::ADMIN, ), diff --git a/config/application.php b/config/application.php index 5daed0b8..36d7c7b7 100644 --- a/config/application.php +++ b/config/application.php @@ -125,6 +125,25 @@ 'Reversed', // -- 'Reversed' ), + 'RandomOptions' => true, // Enable random options lookup. Set this falee to disable + + 'RandomOptionIDs' => include('randomoption_ids.php'), + 'RandomOptionMessages' => include('randomoptions.php'), + + // Card0 special flag. In Older rAthena is 254,255,-256 + 'ItemSpecial' => array( + 'forge' => 0x00FF, + 'create' => 0x00FE, + 'pet' => 0x0100, + ), + + 'BoundLabels' => array( + 1 => 'BoundAccountLabel', + 2 => 'BoundGuildLabel', + 3 => 'BoundPartyLabel', + 4 => 'BoundCharacterLabel', + ), + 'HoldUntrustedAccount' => 0, // This is the time in hours to hold a donation crediting process for, if the account // isn't a trusted account. Specify 0 or false to disable this feature. @@ -393,12 +412,14 @@ 'staffsettings' => 'Staff Settings', 'catcontrol' => 'Category Control', ), - 'vending' => array( - 'index' => 'Vendors', - ), - 'buyingstore' => array( - 'index' => 'Buyers', - ), + 'vending' => array( + 'index' => 'Items', + 'vendors' => 'Vendors', + ), + 'buyingstore' => array( + 'index' => 'Items', + 'buyers' => 'Buyers', + ), ), 'AllowMD5PasswordSearch' => false, diff --git a/config/randomoption_ids.php b/config/randomoption_ids.php new file mode 100644 index 00000000..e9443c1f --- /dev/null +++ b/config/randomoption_ids.php @@ -0,0 +1,195 @@ + 'VAR_MAXHPAMOUNT', + 2 => 'VAR_MAXSPAMOUNT', + 3 => 'VAR_STRAMOUNT', + 4 => 'VAR_AGIAMOUNT', + 5 => 'VAR_VITAMOUNT', + 6 => 'VAR_INTAMOUNT', + 7 => 'VAR_DEXAMOUNT', + 8 => 'VAR_LUKAMOUNT', + 9 => 'VAR_MAXHPPERCENT', + 10 => 'VAR_MAXSPPERCENT', + 11 => 'VAR_HPACCELERATION', + 12 => 'VAR_SPACCELERATION', + 13 => 'VAR_ATKPERCENT', + 14 => 'VAR_MAGICATKPERCENT', + 15 => 'VAR_PLUSASPD', + 16 => 'VAR_PLUSASPDPERCENT', + 17 => 'VAR_ATTPOWER', + 18 => 'VAR_HITSUCCESSVALUE', + 19 => 'VAR_ATTMPOWER', + 20 => 'VAR_ITEMDEFPOWER', + 21 => 'VAR_MDEFPOWER', + 22 => 'VAR_AVOIDSUCCESSVALUE', + 23 => 'VAR_PLUSAVOIDSUCCESSVALUE', + 24 => 'VAR_CRITICALSUCCESSVALUE', + 25 => 'ATTR_TOLERACE_NOTHING', + 26 => 'ATTR_TOLERACE_WATER', + 27 => 'ATTR_TOLERACE_GROUND', + 28 => 'ATTR_TOLERACE_FIRE', + 29 => 'ATTR_TOLERACE_WIND', + 30 => 'ATTR_TOLERACE_POISON', + 31 => 'ATTR_TOLERACE_SAINT', + 32 => 'ATTR_TOLERACE_DARKNESS', + 33 => 'ATTR_TOLERACE_TELEKINESIS', + 34 => 'ATTR_TOLERACE_UNDEAD', + 35 => 'ATTR_TOLERACE_ALL', + 36 => 'DAMAGE_PROPERTY_NOTHING_USER', + 37 => 'DAMAGE_PROPERTY_NOTHING_TARGET', + 38 => 'DAMAGE_PROPERTY_WATER_USER', + 39 => 'DAMAGE_PROPERTY_WATER_TARGET', + 40 => 'DAMAGE_PROPERTY_GROUND_USER', + 41 => 'DAMAGE_PROPERTY_GROUND_TARGET', + 42 => 'DAMAGE_PROPERTY_FIRE_USER', + 43 => 'DAMAGE_PROPERTY_FIRE_TARGET', + 44 => 'DAMAGE_PROPERTY_WIND_USER', + 45 => 'DAMAGE_PROPERTY_WIND_TARGET', + 46 => 'DAMAGE_PROPERTY_POISON_USER', + 47 => 'DAMAGE_PROPERTY_POISON_TARGET', + 48 => 'DAMAGE_PROPERTY_SAINT_USER', + 49 => 'DAMAGE_PROPERTY_SAINT_TARGET', + 50 => 'DAMAGE_PROPERTY_DARKNESS_USER', + 51 => 'DAMAGE_PROPERTY_DARKNESS_TARGET', + 52 => 'DAMAGE_PROPERTY_TELEKINESIS_USER', + 53 => 'DAMAGE_PROPERTY_TELEKINESIS_TARGET', + 54 => 'DAMAGE_PROPERTY_UNDEAD_USER', + 55 => 'DAMAGE_PROPERTY_UNDEAD_TARGET', + 56 => 'MDAMAGE_PROPERTY_NOTHING_USER', + 57 => 'MDAMAGE_PROPERTY_NOTHING_TARGET', + 58 => 'MDAMAGE_PROPERTY_WATER_USER', + 59 => 'MDAMAGE_PROPERTY_WATER_TARGET', + 60 => 'MDAMAGE_PROPERTY_GROUND_USER', + 61 => 'MDAMAGE_PROPERTY_GROUND_TARGET', + 62 => 'MDAMAGE_PROPERTY_FIRE_USER', + 63 => 'MDAMAGE_PROPERTY_FIRE_TARGET', + 64 => 'MDAMAGE_PROPERTY_WIND_USER', + 65 => 'MDAMAGE_PROPERTY_WIND_TARGET', + 66 => 'MDAMAGE_PROPERTY_POISON_USER', + 67 => 'MDAMAGE_PROPERTY_POISON_TARGET', + 68 => 'MDAMAGE_PROPERTY_SAINT_USER', + 69 => 'MDAMAGE_PROPERTY_SAINT_TARGET', + 70 => 'MDAMAGE_PROPERTY_DARKNESS_USER', + 71 => 'MDAMAGE_PROPERTY_DARKNESS_TARGET', + 72 => 'MDAMAGE_PROPERTY_TELEKINESIS_USER', + 73 => 'MDAMAGE_PROPERTY_TELEKINESIS_TARGET', + 74 => 'MDAMAGE_PROPERTY_UNDEAD_USER', + 75 => 'MDAMAGE_PROPERTY_UNDEAD_TARGET', + 76 => 'BODY_ATTR_NOTHING', + 77 => 'BODY_ATTR_WATER', + 78 => 'BODY_ATTR_GROUND', + 79 => 'BODY_ATTR_FIRE', + 80 => 'BODY_ATTR_WIND', + 81 => 'BODY_ATTR_POISON', + 82 => 'BODY_ATTR_SAINT', + 83 => 'BODY_ATTR_DARKNESS', + 84 => 'BODY_ATTR_TELEKINESIS', + 85 => 'BODY_ATTR_UNDEAD', + 86 => 'BODY_ATTR_ALL', + 87 => 'RACE_TOLERACE_NOTHING', + 88 => 'RACE_TOLERACE_UNDEAD', + 89 => 'RACE_TOLERACE_ANIMAL', + 90 => 'RACE_TOLERACE_PLANT', + 91 => 'RACE_TOLERACE_INSECT', + 92 => 'RACE_TOLERACE_FISHS', + 93 => 'RACE_TOLERACE_DEVIL', + 94 => 'RACE_TOLERACE_HUMAN', + 95 => 'RACE_TOLERACE_ANGEL', + 96 => 'RACE_TOLERACE_DRAGON', + 97 => 'RACE_DAMAGE_NOTHING', + 98 => 'RACE_DAMAGE_UNDEAD', + 99 => 'RACE_DAMAGE_ANIMAL', + 100 => 'RACE_DAMAGE_PLANT', + 101 => 'RACE_DAMAGE_INSECT', + 102 => 'RACE_DAMAGE_FISHS', + 103 => 'RACE_DAMAGE_DEVIL', + 104 => 'RACE_DAMAGE_HUMAN', + 105 => 'RACE_DAMAGE_ANGEL', + 106 => 'RACE_DAMAGE_DRAGON', + 107 => 'RACE_MDAMAGE_NOTHING', + 108 => 'RACE_MDAMAGE_UNDEAD', + 109 => 'RACE_MDAMAGE_ANIMAL', + 110 => 'RACE_MDAMAGE_PLANT', + 111 => 'RACE_MDAMAGE_INSECT', + 112 => 'RACE_MDAMAGE_FISHS', + 113 => 'RACE_MDAMAGE_DEVIL', + 114 => 'RACE_MDAMAGE_HUMAN', + 115 => 'RACE_MDAMAGE_ANGEL', + 116 => 'RACE_MDAMAGE_DRAGON', + 117 => 'RACE_CRI_PERCENT_NOTHING', + 118 => 'RACE_CRI_PERCENT_UNDEAD', + 119 => 'RACE_CRI_PERCENT_ANIMAL', + 120 => 'RACE_CRI_PERCENT_PLANT', + 121 => 'RACE_CRI_PERCENT_INSECT', + 122 => 'RACE_CRI_PERCENT_FISHS', + 123 => 'RACE_CRI_PERCENT_DEVIL', + 124 => 'RACE_CRI_PERCENT_HUMAN', + 125 => 'RACE_CRI_PERCENT_ANGEL', + 126 => 'RACE_CRI_PERCENT_DRAGON', + 127 => 'RACE_IGNORE_DEF_PERCENT_NOTHING', + 128 => 'RACE_IGNORE_DEF_PERCENT_UNDEAD', + 129 => 'RACE_IGNORE_DEF_PERCENT_ANIMAL', + 130 => 'RACE_IGNORE_DEF_PERCENT_PLANT', + 131 => 'RACE_IGNORE_DEF_PERCENT_INSECT', + 132 => 'RACE_IGNORE_DEF_PERCENT_FISHS', + 133 => 'RACE_IGNORE_DEF_PERCENT_DEVIL', + 134 => 'RACE_IGNORE_DEF_PERCENT_HUMAN', + 135 => 'RACE_IGNORE_DEF_PERCENT_ANGEL', + 136 => 'RACE_IGNORE_DEF_PERCENT_DRAGON', + 137 => 'RACE_IGNORE_MDEF_PERCENT_NOTHING', + 138 => 'RACE_IGNORE_MDEF_PERCENT_UNDEAD', + 139 => 'RACE_IGNORE_MDEF_PERCENT_ANIMAL', + 140 => 'RACE_IGNORE_MDEF_PERCENT_PLANT', + 141 => 'RACE_IGNORE_MDEF_PERCENT_INSECT', + 142 => 'RACE_IGNORE_MDEF_PERCENT_FISHS', + 143 => 'RACE_IGNORE_MDEF_PERCENT_DEVIL', + 144 => 'RACE_IGNORE_MDEF_PERCENT_HUMAN', + 145 => 'RACE_IGNORE_MDEF_PERCENT_ANGEL', + 146 => 'RACE_IGNORE_MDEF_PERCENT_DRAGON', + 147 => 'CLASS_DAMAGE_NORMAL_TARGET', + 148 => 'CLASS_DAMAGE_BOSS_TARGET', + 149 => 'CLASS_DAMAGE_NORMAL_USER', + 150 => 'CLASS_DAMAGE_BOSS_USER', + 151 => 'CLASS_MDAMAGE_NORMAL', + 152 => 'CLASS_MDAMAGE_BOSS', + 153 => 'CLASS_IGNORE_DEF_PERCENT_NORMAL', + 154 => 'CLASS_IGNORE_DEF_PERCENT_BOSS', + 155 => 'CLASS_IGNORE_MDEF_PERCENT_NORMAL', + 156 => 'CLASS_IGNORE_MDEF_PERCENT_BOSS', + 157 => 'DAMAGE_SIZE_SMALL_TARGET', + 158 => 'DAMAGE_SIZE_MIDIUM_TARGET', + 159 => 'DAMAGE_SIZE_LARGE_TARGET', + 160 => 'DAMAGE_SIZE_SMALL_USER', + 161 => 'DAMAGE_SIZE_MIDIUM_USER', + 162 => 'DAMAGE_SIZE_LARGE_USER', + 163 => 'DAMAGE_SIZE_PERFECT', + 164 => 'DAMAGE_CRI_TARGET', + 165 => 'DAMAGE_CRI_USER', + 166 => 'RANGE_ATTACK_DAMAGE_TARGET', + 167 => 'RANGE_ATTACK_DAMAGE_USER', + 168 => 'HEAL_VALUE', + 169 => 'HEAL_MODIFY_PERCENT', + 170 => 'DEC_SPELL_CAST_TIME', + 171 => 'DEC_SPELL_DELAY_TIME', + 172 => 'DEC_SP_CONSUMPTION', + 173 => 'HP_DRAIN', + 174 => 'SP_DRAIN', + 175 => 'WEAPON_ATTR_NOTHING', + 176 => 'WEAPON_ATTR_WATER', + 177 => 'WEAPON_ATTR_GROUND', + 178 => 'WEAPON_ATTR_FIRE', + 179 => 'WEAPON_ATTR_WIND', + 180 => 'WEAPON_ATTR_POISON', + 181 => 'WEAPON_ATTR_SAINT', + 182 => 'WEAPON_ATTR_DARKNESS', + 183 => 'WEAPON_ATTR_TELEKINESIS', + 184 => 'WEAPON_ATTR_UNDEAD', + 185 => 'WEAPON_INDESTRUCTIBLE', + 186 => 'BODY_INDESTRUCTIBLE', + 187 => 'MDAMAGE_SIZE_SMALL_TARGET', + 188 => 'MDAMAGE_SIZE_MIDIUM_TARGET', + 189 => 'MDAMAGE_SIZE_LARGE_TARGET', + 190 => 'MDAMAGE_SIZE_SMALL_USER', + 191 => 'MDAMAGE_SIZE_MIDIUM_USER', + 192 => 'MDAMAGE_SIZE_LARGE_USER', +); diff --git a/config/randomoptions.php b/config/randomoptions.php new file mode 100644 index 00000000..2b9fb571 --- /dev/null +++ b/config/randomoptions.php @@ -0,0 +1,192 @@ + "MaxHP +%d", + 'VAR_MAXSPAMOUNT' => "MaxSP +%d", + 'VAR_STRAMOUNT' => "STR +%d", + 'VAR_AGIAMOUNT' => "AGI +%d", + 'VAR_VITAMOUNT' => "VIT +%d", + 'VAR_INTAMOUNT' => "INT +%d", + 'VAR_DEXAMOUNT' => "DEX +%d", + 'VAR_LUKAMOUNT' => "LUK +%d", + 'VAR_MAXHPPERCENT' => "MaxHP +%d%%", + 'VAR_MAXSPPERCENT' => "MaxSP +%d%%", + 'VAR_HPACCELERATION' => "Increases natural HP regeneration by %d%%", + 'VAR_SPACCELERATION' => "Increases natural SP regeneration by %d%%", + 'VAR_ATKPERCENT' => "ATK +%d%%", + 'VAR_MAGICATKPERCENT' => "MATK +%d%%", + 'VAR_PLUSASPD' => "ASPD +%d", + 'VAR_PLUSASPDPERCENT' => "Increases attack speed (reduce delay after attack by %d%%)", + 'VAR_ATTPOWER' => "ATK +%d", + 'VAR_HITSUCCESSVALUE' => "HIT +%d", + 'VAR_ATTMPOWER' => "MATK +%d", + 'VAR_ITEMDEFPOWER' => "DEF +%d", + 'VAR_MDEFPOWER' => "MDEF +%d", + 'VAR_AVOIDSUCCESSVALUE' => "FLEE +%d", + 'VAR_PLUSAVOIDSUCCESSVALUE' => "Perfect dodge +%d", + 'VAR_CRITICALSUCCESSVALUE' => "CRIT +%d", + 'ATTR_TOLERACE_NOTHING' => "Increases resistance against Neutral property attack by %d%%", + 'ATTR_TOLERACE_WATER' => "Increases resistance against Water property attack by %d%%", + 'ATTR_TOLERACE_GROUND' => "Increases resistance against Earth property attack by %d%%", + 'ATTR_TOLERACE_FIRE' => "Increases resistance against Fire property attack by %d%%", + 'ATTR_TOLERACE_WIND' => "Increases resistance against Wind property attack by %d%%", + 'ATTR_TOLERACE_POISON' => "Increases resistance against Poison property attack by %d%%", + 'ATTR_TOLERACE_SAINT' => "Increases resistance against Holy property attack by %d%%", + 'ATTR_TOLERACE_DARKNESS' => "Increases resistance against Shadow property attack by %d%%", + 'ATTR_TOLERACE_TELEKINESIS' => "Increases resistance against Ghost property attack by %d%%", + 'ATTR_TOLERACE_UNDEAD' => "Increases resistance against Undead property attack by %d%%", + 'ATTR_TOLERACE_ALL' => "Increases resistance against all properties attack by %d%%", + 'DAMAGE_PROPERTY_NOTHING_USER' => "Decreases physical damage received from Neutral property monster by %d%%", + 'DAMAGE_PROPERTY_NOTHING_TARGET' => "Increases physical damage inflicted on Neutral property monster by %d%%", + 'DAMAGE_PROPERTY_WATER_USER' => "Decreases physical damage received from Water property monster by %d%%", + 'DAMAGE_PROPERTY_WATER_TARGET' => "Increases physical damage inflicted on Water property monster by %d%%", + 'DAMAGE_PROPERTY_GROUND_USER' => "Decreases physical damage received from Earth property monster by %d%%", + 'DAMAGE_PROPERTY_GROUND_TARGET' => "Increases physical damage inflicted on Earth property monster by %d%%", + 'DAMAGE_PROPERTY_FIRE_USER' => "Decreases physical damage received from Fire property monster by %d%%", + 'DAMAGE_PROPERTY_FIRE_TARGET' => "Increases physical damage inflicted on Fire property monster by %d%%", + 'DAMAGE_PROPERTY_WIND_USER' => "Decreases physical damage received from Wind property monster by %d%%", + 'DAMAGE_PROPERTY_WIND_TARGET' => "Increases physical damage inflicted on Wind property monster by %d%%", + 'DAMAGE_PROPERTY_POISON_USER' => "Decreases physical damage received from Poison property monster by %d%%", + 'DAMAGE_PROPERTY_POISON_TARGET' => "Increases physical damage inflicted on Poison property monster by %d%%", + 'DAMAGE_PROPERTY_SAINT_USER' => "Decreases physical damage received from Holy property monster by %d%%", + 'DAMAGE_PROPERTY_SAINT_TARGET' => "Increases physical damage inflicted on Holy property monster by %d%%", + 'DAMAGE_PROPERTY_DARKNESS_USER' => "Decreases physical damage received from Shadow property monster by %d%%", + 'DAMAGE_PROPERTY_DARKNESS_TARGET' => "Increases physical damage inflicted on Shadow property monster by %d%%", + 'DAMAGE_PROPERTY_TELEKINESIS_USER' => "Decreases physical damage received from Ghost property monster by %d%%", + 'DAMAGE_PROPERTY_TELEKINESIS_TARGET' => "Increases physical damage inflicted on Ghost property monster by %d%%", + 'DAMAGE_PROPERTY_UNDEAD_USER' => "Decreases physical damage received from Undead property monster by %d%%", + 'DAMAGE_PROPERTY_UNDEAD_TARGET' => "Increases physical damage inflicted on Undead property monster by %d%%", + 'MDAMAGE_PROPERTY_NOTHING_USER' => "Decreases magical damage received from Neutral property monster by %d%%", + 'MDAMAGE_PROPERTY_NOTHING_TARGET' => "Increases magical damage inflicted on Neutral property monster by %d%%", + 'MDAMAGE_PROPERTY_WATER_USER' => "Decreases magical damage received from Water property monster by %d%%", + 'MDAMAGE_PROPERTY_WATER_TARGET' => "Increases magical damage inflicted on Water property monster by %d%%", + 'MDAMAGE_PROPERTY_GROUND_USER' => "Decreases magical damage received from Earth property monster by %d%%", + 'MDAMAGE_PROPERTY_GROUND_TARGET' => "Increases magical damage inflicted on Earth property monster by %d%%", + 'MDAMAGE_PROPERTY_FIRE_USER' => "Decreases magical damage received from Fire property monster by %d%%", + 'MDAMAGE_PROPERTY_FIRE_TARGET' => "Increases magical damage inflicted on Fire property monster by %d%%", + 'MDAMAGE_PROPERTY_WIND_USER' => "Decreases magical damage received from Wind property monster by %d%%", + 'MDAMAGE_PROPERTY_WIND_TARGET' => "Increases magical damage inflicted on Wind property monster by %d%%", + 'MDAMAGE_PROPERTY_POISON_USER' => "Decreases magical damage received from Poison property monster by %d%%", + 'MDAMAGE_PROPERTY_POISON_TARGET' => "Increases magical damage inflicted on Poison property monster by %d%%", + 'MDAMAGE_PROPERTY_SAINT_USER' => "Decreases magical damage received from Holy property monster by %d%%", + 'MDAMAGE_PROPERTY_SAINT_TARGET' => "Increases magical damage inflicted on Holy property monster by %d%%", + 'MDAMAGE_PROPERTY_DARKNESS_USER' => "Decreases magical damage received from Shadow property monster by %d%%", + 'MDAMAGE_PROPERTY_DARKNESS_TARGET' => "Increases magical damage inflicted on Shadow property monster by %d%%", + 'MDAMAGE_PROPERTY_TELEKINESIS_USER' => "Decreases magical damage received from Ghost property monster by %d%%", + 'MDAMAGE_PROPERTY_TELEKINESIS_TARGET' => "Increases magical damage inflicted on Ghost property monster by %d%%", + 'MDAMAGE_PROPERTY_UNDEAD_USER' => "Decreases magical damage received from Undead property monster by %d%%", + 'MDAMAGE_PROPERTY_UNDEAD_TARGET' => "Increases magical damage inflicted on Undead property monster by %d%%", + 'BODY_ATTR_NOTHING' => "Grant armor with Neutral property", + 'BODY_ATTR_WATER' => "Grant armor with Water property", + 'BODY_ATTR_GROUND' => "Grant armor with Earth property", + 'BODY_ATTR_FIRE' => "Grant armor with Fire property", + 'BODY_ATTR_WIND' => "Grant armor with Wind property", + 'BODY_ATTR_POISON' => "Grant armor with Poison property", + 'BODY_ATTR_SAINT' => "Grant armor with Holy property", + 'BODY_ATTR_DARKNESS' => "Grant armor with Shadow property", + 'BODY_ATTR_TELEKINESIS' => "Grant armor with Ghost property", + 'BODY_ATTR_UNDEAD' => "Grant armor with Undead property", + 'RACE_TOLERACE_NOTHING' => "Increases resistance against Formless monster by %d%%", + 'RACE_TOLERACE_UNDEAD' => "Increases resistance against Undead monster by %d%%", + 'RACE_TOLERACE_ANIMAL' => "Increases resistance against Brute monster by %d%%", + 'RACE_TOLERACE_PLANT' => "Increases resistance against Plant monster by %d%%", + 'RACE_TOLERACE_INSECT' => "Increases resistance against Insect monster by %d%%", + 'RACE_TOLERACE_FISHS' => "Increases resistance against Fish monster by %d%%", + 'RACE_TOLERACE_DEVIL' => "Increases resistance against Demon monster by %d%%", + 'RACE_TOLERACE_HUMAN' => "Increases resistance against Demihuman monster by %d%%", + 'RACE_TOLERACE_ANGEL' => "Increases resistance against Angel monster by %d%%", + 'RACE_TOLERACE_DRAGON' => "Increases resistance against Dragon monster by %d%%", + 'RACE_DAMAGE_NOTHING' => "Increases physical damage inflicted on Formless monster by %d%%", + 'RACE_DAMAGE_UNDEAD' => "Increases physical damage inflicted on Undead monster by %d%%", + 'RACE_DAMAGE_ANIMAL' => "Increases physical damage inflicted on Brute monster by %d%%", + 'RACE_DAMAGE_PLANT' => "Increases physical damage inflicted on Plant monster by %d%%", + 'RACE_DAMAGE_INSECT' => "Increases physical damage inflicted on Insect monster by %d%%", + 'RACE_DAMAGE_FISHS' => "Increases physical damage inflicted on Fish monster by %d%%", + 'RACE_DAMAGE_DEVIL' => "Increases physical damage inflicted on Demon monster by %d%%", + 'RACE_DAMAGE_HUMAN' => "Increases physical damage inflicted on Demihuman monster by %d%%", + 'RACE_DAMAGE_ANGEL' => "Increases physical damage inflicted on Angel monster by %d%%", + 'RACE_DAMAGE_DRAGON' => "Increases physical damage inflicted on Dragon monster by %d%%", + 'RACE_MDAMAGE_NOTHING' => "Increases magical damage inflicted on Formless monster by %d%%", + 'RACE_MDAMAGE_UNDEAD' => "Increases magical damage inflicted on Undead monster by %d%%", + 'RACE_MDAMAGE_ANIMAL' => "Increases magical damage inflicted on Brute monster by %d%%", + 'RACE_MDAMAGE_PLANT' => "Increases magical damage inflicted on Plant monster by %d%%", + 'RACE_MDAMAGE_INSECT' => "Increases magical damage inflicted on Insect monster by %d%%", + 'RACE_MDAMAGE_FISHS' => "Increases magical damage inflicted on Fish monster by %d%%", + 'RACE_MDAMAGE_DEVIL' => "Increases magical damage inflicted on Devil monster by %d%%", + 'RACE_MDAMAGE_HUMAN' => "Increases magical damage inflicted on Demihuman monster by %d%%", + 'RACE_MDAMAGE_ANGEL' => "Increases magical damage inflicted on Angel monster by %d%%", + 'RACE_MDAMAGE_DRAGON' => "Increases magical damage inflicted on Dragon monster by %d%%", + 'RACE_CRI_PERCENT_NOTHING' => "To Formless monster CRIT +%d/10", + 'RACE_CRI_PERCENT_UNDEAD' => "To Undeard monster CRIT +%d/10", + 'RACE_CRI_PERCENT_ANIMAL' => "To Brute monster CRIT +%d/10", + 'RACE_CRI_PERCENT_PLANT' => "To Plant monster CRIT +%d/10", + 'RACE_CRI_PERCENT_INSECT' => "To Insect monster CRIT +%d/10", + 'RACE_CRI_PERCENT_FISHS' => "To Fish monster CRIT +%d/10", + 'RACE_CRI_PERCENT_DEVIL' => "To Demon monster CRIT +%d/10", + 'RACE_CRI_PERCENT_HUMAN' => "To Demihuman monster CRIT +%d/10", + 'RACE_CRI_PERCENT_ANGEL' => "To Angel monster CRIT +%d/10", + 'RACE_CRI_PERCENT_DRAGON' => "To Dragon monster CRIT +%d/10", + 'RACE_IGNORE_DEF_PERCENT_NOTHING' => "Ignore %d%% physical defense of Formless monster", + 'RACE_IGNORE_DEF_PERCENT_UNDEAD' => "Ignore %d%% physical defense of Undead monster", + 'RACE_IGNORE_DEF_PERCENT_ANIMAL' => "Ignore %d%% physical defense of Brute monster", + 'RACE_IGNORE_DEF_PERCENT_PLANT' => "Ignore %d%% physical defense of Plant monster", + 'RACE_IGNORE_DEF_PERCENT_INSECT' => "Ignore %d%% physical defense of Insect monster", + 'RACE_IGNORE_DEF_PERCENT_FISHS' => "Ignore %d%% physical defense of Fish monster", + 'RACE_IGNORE_DEF_PERCENT_DEVIL' => "Ignore %d%% physical defense of Demon monster", + 'RACE_IGNORE_DEF_PERCENT_HUMAN' => "Ignore %d%% physical defense of Demihuman monster", + 'RACE_IGNORE_DEF_PERCENT_ANGEL' => "Ignore %d%% physical defense of Angel monster", + 'RACE_IGNORE_DEF_PERCENT_DRAGON' => "Ignore %d%% physical defense of Dragon monster", + 'RACE_IGNORE_MDEF_PERCENT_NOTHING' => "Ignore %d%% magical defense of Formless monster", + 'RACE_IGNORE_MDEF_PERCENT_UNDEAD' => "Ignore %d%% magical defense of Undead monster", + 'RACE_IGNORE_MDEF_PERCENT_ANIMAL' => "Ignore %d%% magical defense of Brute monster", + 'RACE_IGNORE_MDEF_PERCENT_PLANT' => "Ignore %d%% magical defense of Plant monster", + 'RACE_IGNORE_MDEF_PERCENT_INSECT' => "Ignore %d%% magical defense of Insect monster", + 'RACE_IGNORE_MDEF_PERCENT_FISHS' => "Ignore %d%% magical defense of Fish monster", + 'RACE_IGNORE_MDEF_PERCENT_DEVIL' => "Ignore %d%% magical defense of Demon monster", + 'RACE_IGNORE_MDEF_PERCENT_HUMAN' => "Ignore %d%% magical defense of Demihuman monster", + 'RACE_IGNORE_MDEF_PERCENT_ANGEL' => "Ignore %d%% magical defense of Angel monster", + 'RACE_IGNORE_MDEF_PERCENT_DRAGON' => "Ignore %d%% magical defense of Dragon monster", + 'CLASS_DAMAGE_NORMAL_TARGET' => "Increases physical damage inflicted on Normal monster by %d%%", + 'CLASS_DAMAGE_BOSS_TARGET' => "Increases physical damage inflicted on Boss monster by %d%%", + 'CLASS_DAMAGE_NORMAL_USER' => "Decreases physical damage received from Normal monster by %d%%", + 'CLASS_DAMAGE_BOSS_USER' => "Decreases physical damage received from Boss monster by %d%%", + 'CLASS_MDAMAGE_NORMAL' => "Increases magical damage against Normal monster by %d%%", + 'CLASS_MDAMAGE_BOSS' => "Increases magical damage against Boss monster by %d%%", + 'CLASS_IGNORE_DEF_PERCENT_NORMAL' => "Ignore %d%% physical defense of Normal monster", + 'CLASS_IGNORE_DEF_PERCENT_BOSS' => "Ignore %d%% physical defense of Boss monster", + 'CLASS_IGNORE_MDEF_PERCENT_NORMAL' => "Ignore %d%% magical defense of Normal monster", + 'CLASS_IGNORE_MDEF_PERCENT_BOSS' => "Ignore %d%% magical defense of Boss monster", + 'DAMAGE_SIZE_SMALL_TARGET' => "Increases damage inflicted on Small size monster by %d%%", + 'DAMAGE_SIZE_MIDIUM_TARGET' => "Increases damage inflicted on Medium size monster by %d%%", + 'DAMAGE_SIZE_LARGE_TARGET' => "Increases damage inflicted on Large size monster by %d%%", + 'DAMAGE_SIZE_SMALL_USER' => "Decreases damage received from Small size monster by %d%%", + 'DAMAGE_SIZE_MIDIUM_USER' => "Decreases damage received from Medium size monster by %d%%", + 'DAMAGE_SIZE_LARGE_USER' => "Decreases damage received from Large size monster by %d%%", + 'DAMAGE_SIZE_PERFECT' => "Remove weapon's size penalty", + 'DAMAGE_CRI_TARGET' => "Increases critical damage by %d%%", + 'DAMAGE_CRI_USER' => "Decreases critical damage by %d%%", + 'RANGE_ATTACK_DAMAGE_TARGET' => "Increases ranged physical damage by %d%%", + 'RANGE_ATTACK_DAMAGE_USER' => "Decreases ranged physical damage by %d%%", + 'HEAL_VALUE' => "Increases healing skill by %d%%", + 'HEAL_MODIFY_PERCENT' => "Increases heal received effectiveness by %d%%", + 'DEC_SPELL_CAST_TIME' => "Reduce variable cast time by %d%%", + 'DEC_SPELL_DELAY_TIME' => "Reduce after cast delay by %d%%", + 'DEC_SP_CONSUMPTION' => "Decreases SP consumption by %d%%", + 'WEAPON_ATTR_NOTHING' => "Grant weapon with Neutral property", + 'WEAPON_ATTR_WATER' => "Grant weapon with Water property", + 'WEAPON_ATTR_GROUND' => "Grant weapon with Earth property", + 'WEAPON_ATTR_FIRE' => "Grant weapon with Fire property", + 'WEAPON_ATTR_WIND' => "Grant weapon with Wind property", + 'WEAPON_ATTR_POISON' => "Grant weapon with Poison property", + 'WEAPON_ATTR_SAINT' => "Grant weapon with Holy property", + 'WEAPON_ATTR_DARKNESS' => "Grant weapon with Shadow property", + 'WEAPON_ATTR_TELEKINESIS' => "Grant weapon with Ghost property", + 'WEAPON_ATTR_UNDEAD' => "Grant weapon with Undead property", + 'WEAPON_INDESTRUCTIBLE' => "Indestructible", + 'BODY_INDESTRUCTIBLE' => "Indestructible", + 'MDAMAGE_SIZE_SMALL_TARGET' => "MATK against Small size monster +%d%%", + 'MDAMAGE_SIZE_MIDIUM_TARGET' => "MATK against Medium size monster +%d%%", + 'MDAMAGE_SIZE_LARGE_TARGET' => "MATK against Large size monster +%d%%", + 'MDAMAGE_SIZE_SMALL_USER' => "MDEF against Small size monster +%d%%", + 'MDAMAGE_SIZE_MIDIUM_USER' => "MDEF against Medium size monster +%d%%", + 'MDAMAGE_SIZE_LARGE_USER' => "MDEF against Large size monster +%d%%", +); diff --git a/lang/en_us.php b/lang/en_us.php index 1a763f71..65c2067d 100755 --- a/lang/en_us.php +++ b/lang/en_us.php @@ -54,6 +54,12 @@ 'ItemCard1Label' => 'Card 1', 'ItemCard2Label' => 'Card 2', 'ItemCard3Label' => 'Card 3', + 'BoundAccountLabel' => 'Account', + 'BoundGuildLabel' => 'Guild', + 'BoundPartyLabel' => 'Party', + 'BoundCharacterLabel' => 'Character', + 'ForgedWeaponVeryLabel' => 'Very', + 'ForgedWeaponStrongLabel' => 'Strong', //SIDEBAR //FluxCP Menu Items diff --git a/lib/Flux.php b/lib/Flux.php index 329dc1b3..ad919b4f 100644 --- a/lib/Flux.php +++ b/lib/Flux.php @@ -934,5 +934,46 @@ public static function monsterSizeName($size) $size = Flux::config("MonsterSizes.$size"); return $size; } + + /** + * Check if item is special + * @param $item Item object fetched from table + * @return True if item's card0 is special, false otherwise + * + * Item is forged: Flux::config('ItemSpecial')->get('forge') + * Item is creation: Flux::config('ItemSpecial')->get('create') + * Item is pet egg: Flux::config('ItemSpecial')->get('pet') + */ + public static function itemIsSpecial($item) { + $special = Flux::config('ItemSpecial'); + if (!$special) + return false; + if ($item->card0 && ($item->card0 == $special->get('forge') || $item->card0 == $special->get('create') || $item->card0 == $special->get('pet'))) + return true; + return false; + } + + /** + * Get random option description + * @param $opt Option ID + * @param $val Option Value + * @param $parm Option Param + * @return Description of item random option with assigned value (and parameter) + */ + public static function getRandomOption($opt,$val,$parm) { + if (!$opt && !$val && !$parm) + return ''; + $ids = Flux::config('RandomOptionIDs'); + if (!$ids) + return ''; + $enum = $ids->get($opt); + if (!$enum || $enum == 'EnumVAR_LAST') + return ''; + $msg = Flux::config('RandomOptionMessages'); + $str = $msg->get($enum); + if (!$str) + return ''; + return sprintf($str, $val, $parm); + } } ?> diff --git a/lib/Flux/Item.php b/lib/Flux/Item.php new file mode 100644 index 00000000..ca85e0ab --- /dev/null +++ b/lib/Flux/Item.php @@ -0,0 +1,189 @@ +server = $server; + + $special = Flux::config('ItemSpecial'); + $this->item_forge_flag = $special->get('forge'); + $this->item_creation_flag = $special->get('create'); + $this->item_egg_flag = $special->get('pet'); + + $this->random_options_enabled = Flux::config('RandomOptions'); + $this->random_options_select = ""; + if ($this->random_options_enabled) { + $this->random_options_select = ",`option_id0`,`option_val0`,`option_parm0`"; + $this->random_options_select .= ",`option_id1`,`option_val1`,`option_parm1`"; + $this->random_options_select .= ",`option_id2`,`option_val2`,`option_parm2`"; + $this->random_options_select .= ",`option_id3`,`option_val3`,`option_parm3`"; + $this->random_options_select .= ",`option_id4`,`option_val4`,`option_parm4`"; + } + + $this->table = "items"; + $this->table_database = "`{$server->charMapDatabase}`.".$this->table; + + $this->select_string = ",".$this->table.".`name_japanese`,".$this->table.".`type`,".$this->table.".`slots` ".$this->random_options_select; + + $this->join_string_tmp = "LEFT JOIN ".$this->table_database." ON `%s`.`%s` = `".$this->table."`.id "; + + $special = Flux::config('ItemSpecial'); + $this->named_item_string_tmp = "LEFT JOIN {$server->charMapDatabase}.`char` AS c "; + $this->named_item_string_tmp .= "ON c.char_id = IF(%s.`card0` IN ('".$special->get('forge')."', '".$special->get('create')."'), "; + $this->named_item_string_tmp .= "IF(%s.`card2` < 0, %s.`card2` + 65536, %s.`card2`) "; + $this->named_item_string_tmp .= "| (%s.`card3` << 16), NULL) "; + + if ($main_table) { + $this->join_string = self::getJoinString($main_table, $column_id); + $this->named_item_string = self::getNamedItemString($main_table); + } + } + + /** + * Get join string from join_string_tmp by assigning table and column as ON clause + * @param $table Table name + * @param $column Column name + */ + public function getJoinString($table, $column) { + return sprintf($this->join_string_tmp, $table, $column); + } + + /** + * Get string for 'named' item as join table + * @param $table Table name + */ + public function getNamedItemString($table) { + return sprintf($this->named_item_string_tmp, $table, $table, $table, $table, $table); + } + + /** + * Check if item has random options + * @param $item Item object fetched from table + * @return Number of options or 0 if doesn't have + */ + public function itemHasOptions($item) { + $c = 0; + if ($item->option_id0) + ++$c; + if ($item->option_id1) + ++$c; + if ($item->option_id2) + ++$c; + if ($item->option_id3) + ++$c; + if ($item->option_id4) + ++$c; + return $c; + } + + /** + * Check if card0 slot is used for flag of forged, creation, or pet egg item + * @param $card0 + */ + public function itemIsSpecial($card0) { + if ($card0 == $this->item_forge_flag || $card0 == $this->item_creation_flag || $card0 == $this->item_egg_flag) + return true; + return false; + } + + /** + * Check if card0 slot is used for flag of forged, creation, or pet egg item + * @param $items List of items as result by table fetching + * @param $tmp Flux_Template instance + */ + public function prettyPrint($items, Flux_Template $tmp = null) { + $cardIDs = array(); + $itemAttributes = Flux::config('Attributes')->toArray(); + + foreach ($items as $item) { + $item->cardsOver = -$item->slots; + + if ($item->card0) { + $cardIDs[] = $item->card0; + $item->cardsOver++; + } + if ($item->card1) { + $cardIDs[] = $item->card1; + $item->cardsOver++; + } + if ($item->card2) { + $cardIDs[] = $item->card2; + $item->cardsOver++; + } + if ($item->card3) { + $cardIDs[] = $item->card3; + $item->cardsOver++; + } + + if (self::itemIsSpecial($item->card0) || $item->cardsOver < 0) { + $item->cardsOver = 0; + } + + $item->options = ($this->random_options_enabled ? self::itemHasOptions($item) : 0); + + if (!self::itemIsSpecial($item->card0)) + continue; + + if ($item->card0 == $this->item_forge_flag) { + $item->slots = 0; + // $item->card1 holds of ((star_crumb_num*5)<<8) + element + // 1280 is value of if star_crumb_num = 1 + if (intval($item->card1/1280) > 0) { + $itemcard1 = intval($item->card1/1280); + $item->forged_prefix = ''; + for ($i = 0; $i < $itemcard1; $i++) + $item->forged_prefix .= Flux::message('ForgedWeaponVeryLabel').' '; + $item->forged_prefix .= Flux::message('ForgedWeaponStrongLabel').' '; + } + $item->is_forged = true; + + if (array_key_exists($item->card1%1280, $itemAttributes)) + $item->element = htmlspecialchars($itemAttributes[$item->card1%1280]); + } + + if ($item->card0 == $this->item_creation_flag) { + $item->is_creation = true; + } + + if ($item->card0 == $this->item_egg_flag) { + $item->is_egg = true; + } + + $item->card0 = $item->card1 = $item->card2 = $item->card3 = 0; + } + + if ($tmp) + $tmp->cardIDs = $cardIDs; + + return $items; + } + +} +?> diff --git a/lib/Flux/Template.php b/lib/Flux/Template.php index fadfd78b..71573036 100644 --- a/lib/Flux/Template.php +++ b/lib/Flux/Template.php @@ -1428,5 +1428,48 @@ public function getName() { return $this->themeName; } + + /** + * Print item's random options in a simple list + * @param $item + * @param + */ + public function showItemRandomOption($item, $idx, $suffix = '') { + if (!$item->option_id0 && !$item->option_id1 && !$item->option_id2 && !$item->option_id3 && !$item->option_id4) + return ''; + $str = ''; + return $str; + } + + public function getPriceStyle($price) { + if ($price >= 1000000000) + return 'price-10'; + if ($price >= 100000000) + return 'price-9'; + if ($price >= 10000000) + return 'price-8'; + if ($price >= 1000000) + return 'price-7'; + if ($price >= 100000) + return 'price-6'; + if ($price >= 10000) + return 'price-5'; + if ($price >= 1000) + return 'price-4'; + if ($price >= 100) + return 'price-3'; + if ($price >= 10) + return 'price-2'; + if ($price >= 1) + return 'price-1'; + return 'price-0'; + } + } ?> diff --git a/modules/account/view.php b/modules/account/view.php index d2572e1b..023f6577 100644 --- a/modules/account/view.php +++ b/modules/account/view.php @@ -5,6 +5,7 @@ $title = Flux::message('AccountViewTitle'); +require_once 'Flux/Item.php'; require_once 'Flux/TemporaryTable.php'; if($server->isRenewal) { @@ -12,8 +13,8 @@ } else { $fromTables = array("{$server->charMapDatabase}.item_db", "{$server->charMapDatabase}.item_db2"); } -$tableName = "{$server->charMapDatabase}.items"; -$tempTable = new Flux_TemporaryTable($server->connection, $tableName, $fromTables); +$itemLib = new Flux_Item($server, 'storage', 'nameid'); +$tempTable = new Flux_TemporaryTable($server->connection, $itemLib->table_database, $fromTables); $creditsTable = Flux::config('FluxTables.CreditsTable'); $creditColumns = 'credits.balance, credits.last_donation_date, credits.last_donation_amount'; @@ -34,17 +35,17 @@ if (!$auth->allowedToViewAccount) { $this->deny(); } - + $sql = "SELECT login.*, {$creditColumns}, {$createColumns} FROM {$server->loginDatabase}.login "; $sql .= "LEFT OUTER JOIN {$server->loginDatabase}.{$creditsTable} AS credits ON login.account_id = credits.account_id "; $sql .= "LEFT OUTER JOIN {$server->loginDatabase}.{$createTable} AS created ON login.account_id = created.account_id "; $sql .= "WHERE login.sex != 'S' AND login.group_id >= 0 AND login.account_id = ? LIMIT 1"; $sth = $server->connection->getStatement($sql); $sth->execute(array($accountID)); - + // Account object. $account = $sth->fetch(); - + if ($account) { $title = sprintf(Flux::message('AccountViewTitle2'), $account->userid); } @@ -70,11 +71,11 @@ $vipexpires = 'Expires '.$dt->format('Y-m-d'); } elseif ($account->vip_time == '0'){ $vipexpires = 'Standard Account'; -} else {$vipexpires = 'Unknown';} +} else {$vipexpires = 'Unknown';} if (count($_POST) && $account) { $reason = (string)$params->get('reason'); - + if ($params->get('tempban') && ($tempBanDate=$params->get('tempban_date'))) { if ($canTempBan) { if ($server->loginServer->temporarilyBan($session->account->account_id, $reason, $account->account_id, $tempBanDate)) { @@ -108,30 +109,30 @@ $tbl = Flux::config('FluxTables.AccountCreateTable'); $sql = "SELECT account_id FROM {$server->loginDatabase}.$tbl WHERE confirmed = 0 AND account_id = ?"; $sth = $server->connection->getStatement($sql); - + $sth->execute(array($account->account_id)); $confirm = $sth->fetch(); - + $sql = "UPDATE {$server->loginDatabase}.$tbl SET confirmed = 1, confirm_expire = NULL WHERE account_id = ?"; $sth = $server->connection->getStatement($sql); - + if ($tempBanned && $auth->allowedToTempUnbanAccount && $server->loginServer->unban($session->account->account_id, $reason, $account->account_id)) { - + if ($confirm) { $sth->execute(array($account->account_id)); } - + $session->setMessageData(Flux::message('AccountLiftTempBan')); $this->redirect($this->url('account', 'view', array('id' => $account->account_id))); } elseif ($permBanned && $auth->allowedToPermUnbanAccount && $server->loginServer->unban($session->account->account_id, $reason, $account->account_id)) { - + if ($confirm) { $sth->execute(array($account->account_id)); } - + $session->setMessageData(Flux::message('AccountLiftPermBan')); $this->redirect($this->url('account', 'view', array('id' => $account->account_id))); } @@ -149,7 +150,7 @@ $characters = array(); foreach ($session->getAthenaServerNames() as $serverName) { $athena = $session->getAthenaServer($serverName); - + $sql = "SELECT ch.*, guild.name AS guild_name, guild.emblem_len AS guild_emblem_len "; $sql .= "FROM {$athena->charMapDatabase}.`char` AS ch "; $sql .= "LEFT OUTER JOIN {$athena->charMapDatabase}.guild ON guild.guild_id = ch.guild_id "; @@ -161,21 +162,18 @@ $characters[$athena->serverName] = $chars; } -$col = "storage.*, items.name_japanese, items.type, items.slots, c.char_id, c.name AS char_name"; - -$sql = "SELECT $col FROM {$server->charMapDatabase}.storage "; -$sql .= "LEFT JOIN {$server->charMapDatabase}.items ON items.id = storage.nameid "; -$sql .= "LEFT JOIN {$server->charMapDatabase}.`char` AS c "; -$sql .= "ON c.char_id = IF(storage.card0 IN (254, 255), "; -$sql .= "IF(storage.card2 < 0, storage.card2 + 65536, storage.card2) "; -$sql .= "| (storage.card3 << 16), NULL) "; -$sql .= "WHERE storage.account_id = ? "; - -if (!$auth->allowedToSeeUnknownItems) { - $sql .= 'AND storage.identify > 0 '; -} - if ($account) { + $sql = "SELECT storage.*,c.`char_id`,c.name AS char_name "; + $sql .= $itemLib->select_string; + $sql .= "FROM {$server->charMapDatabase}.storage "; + $sql .= $itemLib->join_string; + $sql .= $itemLib->named_item_string; + $sql .= "WHERE storage.account_id = ? "; + + if (!$auth->allowedToSeeUnknownItems) { + $sql .= 'AND storage.identify > 0 '; + } + $sql .= "ORDER BY storage.nameid ASC, storage.identify DESC, "; $sql .= "storage.attribute DESC, storage.refine ASC"; @@ -186,39 +184,15 @@ $cards = array(); if ($items) { - $cardIDs = array(); - - foreach ($items as $item) { - $item->cardsOver = -$item->slots; - - if ($item->card0) { - $cardIDs[] = $item->card0; - $item->cardsOver++; - } - if ($item->card1) { - $cardIDs[] = $item->card1; - $item->cardsOver++; - } - if ($item->card2) { - $cardIDs[] = $item->card2; - $item->cardsOver++; - } - if ($item->card3) { - $cardIDs[] = $item->card3; - $item->cardsOver++; - } - - if ($item->card0 == 254 || $item->card0 == 255 || $item->card0 == -256 || $item->cardsOver < 0) { - $item->cardsOver = 0; - } - } + $this->cardIDs = array(); + $items = $itemLib->prettyPrint($items, $this); - if ($cardIDs) { - $ids = implode(',', array_fill(0, count($cardIDs), '?')); + if ($this->cardIDs) { + $ids = implode(',', array_fill(0, count($this->cardIDs), '?')); $sql = "SELECT id, name_japanese FROM {$server->charMapDatabase}.items WHERE id IN ($ids)"; $sth = $server->connection->getStatement($sql); - $sth->execute($cardIDs); + $sth->execute($this->cardIDs); $temp = $sth->fetchAll(); if ($temp) { foreach ($temp as $card) { @@ -227,7 +201,5 @@ } } } - - $itemAttributes = Flux::config('Attributes')->toArray(); } ?> diff --git a/modules/buyingstore/buyers.php b/modules/buyingstore/buyers.php new file mode 100644 index 00000000..f1539853 --- /dev/null +++ b/modules/buyingstore/buyers.php @@ -0,0 +1,51 @@ +get('buyer')); +$shopname = trim($params->get('title')); +$map = trim($params->get('map')); + +$sql_criteria = ""; +$sql_params = array(); +if ($buyer) { + $sql_criteria .= '`name` LIKE ? '; + $sql_params[] = "%$buyer%"; +} +if ($map) { + if (count($sql_params)) + $sql_criteria .= ' AND '; + $sql_criteria .= '`map` LIKE ? '; + $sql_params[] = "%$map%"; +} +if ($shopname) { + if (count($sql_params)) + $sql_criteria .= ' AND '; + $sql_criteria .= '`title` LIKE ? '; + $sql_params[] = "%$shopname%"; +} + +$buyingstore_table = 'buyingstores'; +$sql = "SELECT `$buyingstore_table`.id as buyid, `$buyingstore_table`.sex, `$buyingstore_table`.map, `$buyingstore_table`.x, `$buyingstore_table`.y, `$buyingstore_table`.title, autotrade "; +$sql .= ",`$buyingstore_table`.char_id,`char`.name "; +$sql .= "FROM `$buyingstore_table` "; +$sql .= "LEFT JOIN `char` on `$buyingstore_table`.`char_id` = `char`.char_id "; +if (count($sql_params)) { + $sql .= 'WHERE '.$sql_criteria; +} + +$sortable = array( + 'buyid' => 'ASC', 'name', 'map', 'title' +); + +$sth = $server->connection->getStatement($sql); +$sth->execute($sql_params); +$paginator = $this->getPaginator($sth->rowCount()); +$paginator->setSortableColumns($sortable); + +$sql = $paginator->getSQL($sql); +$sth = $server->connection->getStatement($sql); +$sth->execute($sql_params); + +$stores = $sth->fetchAll(); diff --git a/modules/buyingstore/index.php b/modules/buyingstore/index.php index 7d41595f..d0864bb3 100644 --- a/modules/buyingstore/index.php +++ b/modules/buyingstore/index.php @@ -1,25 +1,56 @@ connection->getStatement("SELECT COUNT(id) AS total FROM buyingstores"); -$sth->execute(); -$paginator = $this->getPaginator($sth->fetch()->total); +$title = 'Buying Items'; + +if ($server->isRenewal) { + $fromTables = array("{$server->charMapDatabase}.item_db_re", "{$server->charMapDatabase}.item_db2_re"); +} else { + $fromTables = array("{$server->charMapDatabase}.item_db", "{$server->charMapDatabase}.item_db2"); +} +$itemDB = "{$server->charMapDatabase}.items"; +$tempTable = new Flux_TemporaryTable($server->connection, $itemDB, $fromTables); + +$item = trim($params->get('item')); + +$sql_criteria = ""; +$sql_params = array(); +if ($item) { + if (count($sql_params)) + $sql_criteria .= ' AND '; + $sql_criteria .= ' `item_name` LIKE ? OR `nameid`=?'; + $sql_params[] = "%$item%"; + $sql_params[] = $item; +} + +$buyingstore_table = 'buyingstores'; +$buyingstore_items_table = 'buyingstore_items'; + +$sql = "SELECT `$buyingstore_table`.id as buyid, `$buyingstore_table`.sex, `$buyingstore_table`.map, `$buyingstore_table`.x, `$buyingstore_table`.y, `$buyingstore_table`.title, autotrade "; +$sql .= ",`$buyingstore_table`.char_id,`char`.name as char_name "; +$sql .= ",`$buyingstore_items_table`.`item_id` as nameid,`$buyingstore_items_table`.price,`$buyingstore_items_table`.amount"; +$sql .= ",`items`.`name_japanese` as item_name, `items`.`slots`, `items`.`type` "; +$sql .= "FROM `$buyingstore_table` "; +$sql .= "LEFT JOIN `char` on `$buyingstore_table`.`char_id` = `char`.char_id "; +$sql .= "LEFT JOIN `$buyingstore_items_table` on `$buyingstore_table`.`id`=`$buyingstore_items_table`.`buyingstore_id` "; +$sql .= "LEFT JOIN items on `$buyingstore_items_table`.item_id = items.id "; + +if (count($sql_params)) { + $sql .= 'HAVING '.$sql_criteria; +} -// Set the sortable columns $sortable = array( - 'id' => 'asc', 'map', 'char_name' + 'item_name' => 'ASC', 'nameid', 'price', 'title' ); +$sth = $server->connection->getStatement($sql); +$sth->execute($sql_params); +$paginator = $this->getPaginator($sth->rowCount()); $paginator->setSortableColumns($sortable); -// Create the main request. -$sql = "SELECT `buyingstores`.char_id,`char`.name as char_name, `buyingstores`.id, `buyingstores`.sex, `buyingstores`.map, `buyingstores`.x, `buyingstores`.y, `buyingstores`.title, autotrade "; -$sql .= "FROM buyingstores "; -$sql .= "LEFT JOIN `char` on buyingstores.char_id = `char`.char_id "; $sql = $paginator->getSQL($sql); $sth = $server->connection->getStatement($sql); -$sth->execute(); +$sth->execute($sql_params); -$stores = $sth->fetchAll(); +$items = $sth->fetchAll(); diff --git a/modules/buyingstore/viewshop.php b/modules/buyingstore/viewshop.php index 7ed11d57..529d03bf 100644 --- a/modules/buyingstore/viewshop.php +++ b/modules/buyingstore/viewshop.php @@ -11,8 +11,10 @@ $sth->execute(array($params->get("id"))); $store = $sth->fetch(); +$showitems = false; + if ($store) { - $title = 'Buyer Items Of [' . $store->char_name . ']'; + $title = 'Buying Items Of [' . $store->char_name . ']'; // Create the itemdb temp table to retrieve names. if ($server->isRenewal) { diff --git a/modules/character/view.php b/modules/character/view.php index 49dafb6e..1ad3a7c9 100644 --- a/modules/character/view.php +++ b/modules/character/view.php @@ -5,6 +5,7 @@ $title = 'Viewing Character'; +require_once 'Flux/Item.php'; require_once 'Flux/TemporaryTable.php'; if($server->isRenewal) { @@ -15,6 +16,7 @@ $mobdb = array("mob_db","mob_db2"); } $tableName = "{$server->charMapDatabase}.items"; +$itemLib = new Flux_Item($server); $tempTable = new Flux_TemporaryTable($server->connection, $tableName, $fromTables); $charID = $params->get('id'); @@ -114,14 +116,11 @@ $partyMembers = array(); } - $col = "inventory.*, items.name_japanese, items.type, items.slots, c.char_id, c.name AS char_name"; - - $sql = "SELECT $col FROM {$server->charMapDatabase}.inventory "; - $sql .= "LEFT JOIN {$server->charMapDatabase}.items ON items.id = inventory.nameid "; - $sql .= "LEFT JOIN {$server->charMapDatabase}.`char` AS c "; - $sql .= "ON c.char_id = IF(inventory.card0 IN (254, 255), "; - $sql .= "IF(inventory.card2 < 0, inventory.card2 + 65536, inventory.card2) "; - $sql .= "| (inventory.card3 << 16), NULL) "; + $sql = "SELECT inventory.*, c.char_id, c.name AS char_name"; + $sql .= $itemLib->select_string; + $sql .= "FROM {$server->charMapDatabase}.inventory "; + $sql .= $itemLib->getJoinString('inventory','nameid'); + $sql .= $itemLib->getNamedItemString('inventory'); $sql .= "WHERE inventory.char_id = ? "; if (!$auth->allowedToSeeUnknownItems) { @@ -138,39 +137,15 @@ $cards = array(); if ($items) { - $cardIDs = array(); - - foreach ($items as $item) { - $item->cardsOver = -$item->slots; - - if ($item->card0) { - $cardIDs[] = $item->card0; - $item->cardsOver++; - } - if ($item->card1) { - $cardIDs[] = $item->card1; - $item->cardsOver++; - } - if ($item->card2) { - $cardIDs[] = $item->card2; - $item->cardsOver++; - } - if ($item->card3) { - $cardIDs[] = $item->card3; - $item->cardsOver++; - } - - if ($item->card0 == 254 || $item->card0 == 255 || $item->card0 == -256 || $item->cardsOver < 0) { - $item->cardsOver = 0; - } - } + $this->cardIDs = array(); + $items = $itemLib->prettyPrint($items, $this); - if ($cardIDs) { - $ids = implode(',', array_fill(0, count($cardIDs), '?')); + if ($this->cardIDs) { + $ids = implode(',', array_fill(0, count($this->cardIDs), '?')); $sql = "SELECT id, name_japanese FROM {$server->charMapDatabase}.items WHERE id IN ($ids)"; $sth = $server->connection->getStatement($sql); - $sth->execute($cardIDs); + $sth->execute($this->cardIDs); $temp = $sth->fetchAll(); if ($temp) { foreach ($temp as $card) { @@ -180,14 +155,11 @@ } } - $col = "cart_inventory.*, items.name_japanese, items.type, items.slots, c.char_id, c.name AS char_name"; - - $sql = "SELECT $col FROM {$server->charMapDatabase}.cart_inventory "; - $sql .= "LEFT JOIN {$server->charMapDatabase}.items ON items.id = cart_inventory.nameid "; - $sql .= "LEFT JOIN {$server->charMapDatabase}.`char` AS c "; - $sql .= "ON c.char_id = IF(cart_inventory.card0 IN (254, 255), "; - $sql .= "IF(cart_inventory.card2 < 0, cart_inventory.card2 + 65536, cart_inventory.card2) "; - $sql .= "| (cart_inventory.card3 << 16), NULL) "; + $sql = "SELECT cart_inventory.*, c.char_id, c.name AS char_name "; + $sql .= $itemLib->select_string; + $sql .= "FROM {$server->charMapDatabase}.cart_inventory "; + $sql .= $itemLib->getJoinString('cart_inventory','nameid'); + $sql .= $itemLib->getNamedItemString('cart_inventory'); $sql .= "WHERE cart_inventory.char_id = ? "; if (!$auth->allowedToSeeUnknownItems) { @@ -205,38 +177,14 @@ if ($cart_items) { $cardIDs = array(); + $cart_items = $itemLib->prettyPrint($cart_items, $this); - foreach ($cart_items as $item) { - $item->cardsOver = -$item->slots; - - if ($item->card0) { - $cardIDs[] = $item->card0; - $item->cardsOver++; - } - if ($item->card1) { - $cardIDs[] = $item->card1; - $item->cardsOver++; - } - if ($item->card2) { - $cardIDs[] = $item->card2; - $item->cardsOver++; - } - if ($item->card3) { - $cardIDs[] = $item->card3; - $item->cardsOver++; - } - - if ($item->card0 == 254 || $item->card0 == 255 || $item->card0 == -256 || $item->cardsOver < 0) { - $item->cardsOver = 0; - } - } - - if ($cardIDs) { - $ids = implode(',', array_fill(0, count($cardIDs), '?')); + if ($this->cardIDs) { + $ids = implode(',', array_fill(0, count($this->cardIDs), '?')); $sql = "SELECT id, name_japanese FROM {$server->charMapDatabase}.items WHERE id IN ($ids)"; $sth = $server->connection->getStatement($sql); - $sth->execute($cardIDs); + $sth->execute($this->cardIDs); $temp = $sth->fetchAll(); if ($temp) { foreach ($temp as $card) { @@ -245,7 +193,5 @@ } } } - - $itemAttributes = Flux::config('Attributes')->toArray(); } ?> diff --git a/modules/vending/index.php b/modules/vending/index.php index 8a2b4450..e0445a8e 100644 --- a/modules/vending/index.php +++ b/modules/vending/index.php @@ -1,27 +1,101 @@ connection->getStatement("SELECT COUNT(id) AS total FROM vendings"); -$sth->execute(); -$paginator = $this->getPaginator($sth->fetch()->total); +$title = 'Vending Items'; + +if ($server->isRenewal) { + $fromTables = array("{$server->charMapDatabase}.item_db_re", "{$server->charMapDatabase}.item_db2_re"); +} else { + $fromTables = array("{$server->charMapDatabase}.item_db", "{$server->charMapDatabase}.item_db2"); +} +$itemDB = "{$server->charMapDatabase}.items"; +$itemLib = new Flux_Item($server); +$tempTable = new Flux_TemporaryTable($server->connection, $itemDB, $fromTables); + +$item = trim($params->get('item')); +$refine = trim($params->get('refine')); +$card = trim($params->get('card')); + +$sql_criteria1 = ""; +$sql_criteria2 = ""; +$sql_params1 = array(); +$sql_params2 = array(); +if ($refine) { + $sql_criteria1 .= '`ci`.`refine`=?'; + $sql_params1[] = $refine; +} +if ($card) { + if (count($sql_params1)) + $sql_criteria1 .= ' AND '; + $sql_criteria1 .= '(`ci`.`card0`=? OR `ci`.`card1`=? OR `ci`.`card2`=? OR `ci`.`card3`=?) '; + $sql_params1[] = $card; + $sql_params1[] = $card; + $sql_params1[] = $card; + $sql_params1[] = $card; +} +if ($item) { + if (count($sql_params2)) + $sql_criteria2 .= ' AND '; + $sql_criteria2 .= ' `name_japanese` LIKE ? OR `nameid`=?'; + $sql_params2[] = "%$item%"; + $sql_params2[] = $item; +} + +$vending_table = 'vendings'; +$vending_items_table = 'vending_items'; +$sql = "SELECT `ch`.char_id, `ch`.name as char_name, `$vending_table`.id as vending_id, `$vending_table`.account_id, `$vending_table`.sex, `$vending_table`.map, `$vending_table`.x, `$vending_table`.y, `$vending_table`.title, autotrade "; +$sql .= ",`$vending_items_table`.`cartinventory_id`,`$vending_items_table`.`amount`,`$vending_items_table`.`price`"; +$sql .= ",ci.`nameid`,ci.`refine`,ci.`card0`,ci.`card1`,ci.`card2`,ci.`card3`"; +$sql .= $itemLib->select_string; + +$sql .= "FROM `$vending_items_table` "; +$sql .= "LEFT JOIN `$vending_table` ON `$vending_items_table`.vending_id = `$vending_table`.id "; + +$sql .= "LEFT JOIN `cart_inventory` ci ON `$vending_items_table`.`cartinventory_id` = `ci`.id "; +$sql .= "LEFT JOIN `char` ch ON `$vending_table`.char_id = `ch`.char_id "; +$sql .= $itemLib->getJoinString('ci','nameid'); +$sql .= $itemLib->getNamedItemString('ci'); + +if (count($sql_params1)) { + $sql .= 'WHERE '.$sql_criteria1; +} +if (count($sql_params2)) { + $sql .= 'HAVING '.$sql_criteria2; +} -// Set the sortable columns $sortable = array( - 'id' => 'asc', 'map', 'char_name' - + 'name_japanese' => 'ASC', 'nameid', 'price', 'amount' ); +$sth = $server->connection->getStatement($sql); +$sth->execute(array_merge($sql_params1,$sql_params2)); +$paginator = $this->getPaginator($sth->rowCount()); $paginator->setSortableColumns($sortable); -// Create the main request. -$sql = "SELECT `char`.name as char_name, `vendings`.id, `vendings`.sex, `vendings`.map, `vendings`.x, `vendings`.y, `vendings`.title, autotrade "; -$sql .= "FROM vendings "; -$sql .= "LEFT JOIN `char` on vendings.char_id = `char`.char_id "; -$sql = $paginator->getSQL($sql); -$sth = $server->connection->getStatement($sql); -$sth->execute(); +$sql = $paginator->getSQL($sql); +$sth = $server->connection->getStatement($sql); +$sth->execute(array_merge($sql_params1,$sql_params2)); + +$items = $sth->fetchAll(); + +if ($items) { + //Set the cards + $this->cardIDs = array(); + $items = $itemLib->prettyPrint($items, $this); + + if ($this->cardIDs) { + $ids = implode(',', array_fill(0, count($this->cardIDs), '?')); + $sql = "SELECT id, name_japanese FROM {$server->charMapDatabase}.items WHERE id IN ($ids)"; + $sth = $server->connection->getStatement($sql); -$vendings = $sth->fetchAll(); -?> + $sth->execute($this->cardIDs); + $temp = $sth->fetchAll(); + if ($temp) { + foreach ($temp as $card) { + $cards[$card->id] = $card->name_japanese; + } + } + } +} diff --git a/modules/vending/vendors.php b/modules/vending/vendors.php new file mode 100644 index 00000000..6e1a5608 --- /dev/null +++ b/modules/vending/vendors.php @@ -0,0 +1,51 @@ +get('vendor')); +$shopname = trim($params->get('title')); +$map = trim($params->get('map')); + +$sql_criteria = ""; +$sql_params = array(); +if ($vendor) { + $sql_criteria .= '`name` LIKE ? '; + $sql_params[] = "%$vendor%"; +} +if ($shopname) { + if (count($sql_params)) + $sql_criteria .= ' AND '; + $sql_criteria .= '`title` LIKE ? '; + $sql_params[] = "%$shopname%"; +} +if ($map) { + if (count($sql_params)) + $sql_criteria .= ' AND '; + $sql_criteria .= '`map` LIKE ? '; + $sql_params[] = "%$map%"; +} + +$vending_table = 'vendings'; +$sql = "SELECT `ch`.char_id, `ch`.name, `$vending_table`.id as vending_id, `$vending_table`.account_id, `$vending_table`.sex, `$vending_table`.map, `$vending_table`.x, `$vending_table`.y, `$vending_table`.title, autotrade "; +$sql .= "FROM `$vending_table` "; +$sql .= "LEFT JOIN `char` ch ON `$vending_table`.char_id = `ch`.char_id "; + +if (count($sql_params)) { + $sql .= 'WHERE '.$sql_criteria; +} + +$sortable = array( + 'vending_id' => 'ASC', 'map', 'name', 'title' +); + +$sth = $server->connection->getStatement($sql); +$sth->execute($sql_params); +$paginator = $this->getPaginator($sth->rowCount()); +$paginator->setSortableColumns($sortable); + +$sql = $paginator->getSQL($sql); +$sth = $server->connection->getStatement($sql); +$sth->execute($sql_params); + +$vendors = $sth->fetchAll(); diff --git a/modules/vending/viewshop.php b/modules/vending/viewshop.php index 609f1cd3..7725e45e 100644 --- a/modules/vending/viewshop.php +++ b/modules/vending/viewshop.php @@ -3,11 +3,12 @@ if (!defined('FLUX_ROOT')) exit; +require_once 'Flux/Item.php'; require_once 'Flux/TemporaryTable.php'; // Get the current Vendor values. -$sql = "SELECT `char`.name as char_name, `vendings`.id, `vendings`.account_id, `vendings`.sex, `vendings`.map, `vendings`.x, `vendings`.y, `vendings`.title, autotrade "; +$sql = "SELECT `char`.`name` as char_name, `vendings`.`id`, `vendings`.`account_id`, `vendings`.`char_id`, `vendings`.`sex`, `vendings`.`map`, `vendings`.`x`, `vendings`.`y`, `vendings`.`title`, `autotrade` "; $sql .= "FROM vendings "; $sql .= "LEFT JOIN `char` on vendings.char_id = `char`.char_id where id=?"; $sth = $server->connection->getStatement($sql); @@ -29,67 +30,38 @@ $fromTables = array("{$server->charMapDatabase}.item_db", "{$server->charMapDatabase}.item_db2"); } $itemDB = "{$server->charMapDatabase}.items"; + $itemLib = new Flux_Item($server, 'ci', 'nameid'); $tempTable = new Flux_TemporaryTable($server->connection, $itemDB, $fromTables); // Get the vendor's items. // Get the current Vendor values. - $sql = "SELECT `vending_items`.cartinventory_id, `vending_items`.amount, `vending_items`.price, "; - $sql .= "`cart_inventory`.nameid, `cart_inventory`.refine, `cart_inventory`.card0, `cart_inventory`.card1, `cart_inventory`.card2, c.name as char_name, "; - $sql .= "items.name_japanese as item_name, items.slots, items.type "; + $sql = "SELECT (".$vending->account_id.") AS account_id, (".$vending->char_id.") AS char_id, `vending_items`.`cartinventory_id`, `vending_items`.`amount`, `vending_items`.`price`, "; + $sql .= "`ci`.`nameid`, `ci`.`refine`, `ci`.`card0`, `ci`.`card1`, `ci`.`card2`, `ci`.`card3`, c.`name` as char_name "; + $sql .= $itemLib->select_string; $sql .= "FROM vending_items "; - $sql .= "LEFT JOIN `cart_inventory` on `vending_items`.cartinventory_id = `cart_inventory`.id "; + $sql .= "LEFT JOIN `cart_inventory` ci on `vending_items`.cartinventory_id = `ci`.id "; - $sql .= "LEFT JOIN items on `cart_inventory`.nameid = items.id "; - - $sql .= "LEFT JOIN {$server->charMapDatabase}.`char` AS c "; - $sql .= "ON c.char_id = IF(cart_inventory.card0 IN (254, 255), "; - $sql .= "IF(cart_inventory.card2 < 0, cart_inventory.card2 + 65536, cart_inventory.card2) "; - $sql .= "| (cart_inventory.card3 << 16), NULL) "; + $sql .= $itemLib->join_string; + $sql .= $itemLib->named_item_string; $sql .= "where vending_id = ? "; $sth = $server->connection->getStatement($sql); $sth->execute(array($vending->id)); - $vending_items = $sth->fetchAll(); - $items=$vending_items; - + $items = $sth->fetchAll(); //Set the cards $cards = array(); if ($items) { - $cardIDs = array(); + $this->cardIDs = array(); + $items = $itemLib->prettyPrint($items, $this); - foreach ($items as $item) { - $item->cardsOver = -$item->slots; - - if ($item->card0) { - $cardIDs[] = $item->card0; - $item->cardsOver++; - } - if ($item->card1) { - $cardIDs[] = $item->card1; - $item->cardsOver++; - } - if ($item->card2) { - $cardIDs[] = $item->card2; - $item->cardsOver++; - } - if ($item->card3) { - $cardIDs[] = $item->card3; - $item->cardsOver++; - } - - if ($item->card0 == 254 || $item->card0 == 255 || $item->card0 == -256 || $item->cardsOver < 0) { - $item->cardsOver = 0; - } - } - - if ($cardIDs) { - $ids = implode(',', array_fill(0, count($cardIDs), '?')); + if ($this->cardIDs) { + $ids = implode(',', array_fill(0, count($this->cardIDs), '?')); $sql = "SELECT id, name_japanese FROM {$server->charMapDatabase}.items WHERE id IN ($ids)"; $sth = $server->connection->getStatement($sql); - $sth->execute($cardIDs); + $sth->execute($this->cardIDs); $temp = $sth->fetchAll(); if ($temp) { foreach ($temp as $card) { @@ -98,10 +70,6 @@ } } } - - $itemAttributes = Flux::config('Attributes')->toArray(); - - } else { $title = "No Vendor Found."; } diff --git a/themes/bootstrap/css/flux.css b/themes/bootstrap/css/flux.css index 1f88a8d9..1575e2ad 100644 --- a/themes/bootstrap/css/flux.css +++ b/themes/bootstrap/css/flux.css @@ -1087,3 +1087,15 @@ textarea { color: #ffba00; font-style: italic; } + +.item-options-toggle { + cursor:pointer!important; +} + +ul.item-options { + padding:0 0 0 1.3em; +} + +.item-options li { + text-decoration:underline; +} diff --git a/themes/bootstrap/footer.php b/themes/bootstrap/footer.php index 5cb65c2e..ad2aeda2 100644 --- a/themes/bootstrap/footer.php +++ b/themes/bootstrap/footer.php @@ -135,5 +135,6 @@ function reload(){ + diff --git a/themes/default/account/view.php b/themes/default/account/view.php index ddf9b06a..7f731a61 100644 --- a/themes/default/account/view.php +++ b/themes/default/account/view.php @@ -269,9 +269,9 @@ class="block-link"> Extra - + $item): ?> iconImage($item->nameid) ?> - + bound) echo ' class="bound-item"' ?>> actionAllowed('item', 'view')): ?> linkToItem($item->nameid, $item->nameid) ?> @@ -286,26 +286,28 @@ class="block-link"> refine > 0): ?> +refine) ?> - card0 == 255 && intval($item->card1/1280) > 0): ?> - card1/1280); ?> - - Very - - Strong + forged_prefix): ?> + forged_prefix ?> - card0 == 254 || $item->card0 == 255): ?> + is_forged || $item->is_creation): ?> char_name): ?> actionAllowed('character', 'view') && ($isMine || (!$isMine && $auth->allowedToViewCharacter))): ?> linkToCharacter($item->char_id, $item->char_name, $session->serverName) . "'s" ?> - char_name . "'s") ?> + is_forged): ?> + char_name; ?>'s + is_creation): ?> + char_name; ?>'s + + char_name; ?>'s + 's - card0 == 255 && array_key_exists($item->card1%1280, $itemAttributes)): ?> - card1%1280]) ?> + is_forged && $item->element): ?> + element ?> name_japanese): ?> name_japanese) ?> @@ -315,6 +317,10 @@ class="block-link"> slots): ?> slots . ']') ?> + options): ?> + options." Options]" ?> + showItemRandomOption($item, $idx) ?> + amount) ?> @@ -332,92 +338,54 @@ class="block-link"> - card0 && ($item->type == 4 || $item->type == 5) && $item->card0 != 254 && $item->card0 != 255 && $item->card0 != -256): ?> + card0): ?> card0])): ?> - actionAllowed('item', 'view')): ?> - linkToItem($item->card0, $cards[$item->card0]) ?> - - card0]) ?> - + linkToItem($item->card0, $cards[$item->card0]) ?> - actionAllowed('item', 'view')): ?> - linkToItem($item->card0, $item->card0) ?> - - card0) ?> - + linkToItem($item->card0, $item->card0) ?> - + None - card1 && ($item->type == 4 || $item->type == 5) && $item->card0 != 255 && $item->card0 != -256): ?> + card1): ?> card1])): ?> - actionAllowed('item', 'view')): ?> - linkToItem($item->card1, $cards[$item->card1]) ?> - - card1]) ?> - + linkToItem($item->card1, $cards[$item->card1]) ?> - actionAllowed('item', 'view')): ?> - linkToItem($item->card1, $item->card1) ?> - - card1) ?> - + linkToItem($item->card1, $item->card1) ?> - + None - card2 && ($item->type == 4 || $item->type == 5) && $item->card0 != 254 && $item->card0 != 255 && $item->card0 != -256): ?> + card2): ?> card2])): ?> - actionAllowed('item', 'view')): ?> - linkToItem($item->card2, $cards[$item->card2]) ?> - - card2]) ?> - + linkToItem($item->card2, $cards[$item->card2]) ?> - actionAllowed('item', 'view')): ?> - linkToItem($item->card2, $item->card2) ?> - - card2) ?> - + linkToItem($item->card2, $item->card2) ?> - + None - card3 && ($item->type == 4 || $item->type == 5) && $item->card0 != 254 && $item->card0 != 255 && $item->card0 != -256): ?> + card3): ?> card3])): ?> - actionAllowed('item', 'view')): ?> - linkToItem($item->card3, $cards[$item->card3]) ?> - - card3]) ?> - + linkToItem($item->card3, $cards[$item->card3]) ?> - actionAllowed('item', 'view')): ?> - linkToItem($item->card3, $item->card3) ?> - - card3) ?> - + linkToItem($item->card3, $item->card3) ?> - + None - bound == 1):?> - Account Bound - bound == 2):?> - Guild Bound - bound == 3):?> - Party Bound - bound == 4):?> - Character Bound + bound):?> + get($item->bound)); ?> Bound - None + None diff --git a/themes/default/buyingstore/buyers.php b/themes/default/buyingstore/buyers.php new file mode 100644 index 00000000..6a74163d --- /dev/null +++ b/themes/default/buyingstore/buyers.php @@ -0,0 +1,86 @@ + +

+

Search...

+
+ moduleActionFormInputs($params->get('module')) ?> +

+ + + ... + + + ... + + + ... + + +

+
+ + + infoText() ?> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
sortableColumn('buyid', 'ID') ?> sortableColumn('name', 'Buyer Name') ?>sortableColumn('title', 'Title') ?>sortableColumn('map', 'Map') ?>XYGender
+ actionAllowed('buyingstore', 'viewshop')): ?> + $item->buyid)); ?>">buyid; ?> + + buyid ?> + + + actionAllowed('character', 'view') && $auth->allowedToViewCharacter): ?> + linkToCharacter($item->char_id, $item->name); ?> + + name; ?> + + + + actionAllowed('buyingstore', 'viewshop')): ?> + $item->buyid)); ?>">title; ?> + + title ?> + + + map ?> + + x ?> + + y ?> + + sex ?> +
+ getHTML() ?> + +

No Buyers found. Go back.

+ diff --git a/themes/default/buyingstore/index.php b/themes/default/buyingstore/index.php index e329464d..a7572935 100644 --- a/themes/default/buyingstore/index.php +++ b/themes/default/buyingstore/index.php @@ -1,69 +1,63 @@ -

Buyers

- - +

+

Search...

+
+ moduleActionFormInputs($params->get('module')) ?> +

+ + + ... + + +

+
+ + infoText() ?> - - - - - - - + + + + + - + - - - - - - - - - - -
sortableColumn('id', 'Buyer ID') ?> sortableColumn('char_name', 'Buyer Name') ?>TitlesortableColumn('map', 'Map') ?>XYGendersortableColumn('nameid', 'Item ID') ?>sortableColumn('item_name', 'Name') ?>sortableColumn('price', 'Price') ?>AmountsortableColumn('title', 'Shop Name')?>
- actionAllowed('buyingstore', 'viewshop')): ?> - $store->id)); ?>">id; ?> + actionAllowed('item', 'view')): ?> + $item->nameid)); ?>">nameid; ?> - id ?> + nameid ?> - actionAllowed('character', 'view') && $auth->allowedToViewCharacter): ?> - linkToCharacter($store->char_id, $store->char_name); ?> - - char_name; ?> - + + - - actionAllowed('buyingstore', 'viewshop')): ?> - $store->id)); ?>">title; ?> - - title ?> - + item_name ?> - map ?> + + price, 0, '.', ','); ?> z - x ?> + + amount ?> - y ?> - - sex ?> + actionAllowed('buyingstore', 'viewshop')): ?> + $item->buyid)); ?>">title; ?> + + title ?> +
getHTML() ?> -

No Buyers found. Go back.

+

No Items found. Go back.

diff --git a/themes/default/buyingstore/viewshop.php b/themes/default/buyingstore/viewshop.php index 8cd61dfc..8abadc6b 100644 --- a/themes/default/buyingstore/viewshop.php +++ b/themes/default/buyingstore/viewshop.php @@ -8,8 +8,8 @@ - - + + @@ -24,21 +24,16 @@ nameid ?> - - + + @@ -48,6 +43,8 @@

No Items found. Go back.

+ +

No Buyer found. Go back.

diff --git a/themes/default/character/view.php b/themes/default/character/view.php index 11857aae..c8b9b9a3 100644 --- a/themes/default/character/view.php +++ b/themes/default/character/view.php @@ -356,9 +356,9 @@ - + $item): ?> iconImage($item->nameid) ?> - equip) echo ' class="equipped"' ?>> + equip) echo ' class="equipped"'; else if ($item->bound) echo ' class="bound-item"' ?>> @@ -367,26 +367,28 @@ refine > 0): ?> +refine) ?> - card0 == 255 && intval($item->card1/1280) > 0): ?> - card1/1280); ?> - - Very - - Strong + forged_prefix): ?> + forged_prefix ?> - card0 == 254 || $item->card0 == 255): ?> + is_forged || $item->is_creation): ?> char_name): ?> actionAllowed('character', 'view') && ($isMine || (!$isMine && $auth->allowedToViewCharacter))): ?> linkToCharacter($item->char_id, $item->char_name, $session->serverName) . "'s" ?> - char_name . "'s") ?> + is_forged): ?> + char_name; ?>'s + is_creation): ?> + char_name; ?>'s + + char_name; ?>'s + 's - card0 == 255 && array_key_exists($item->card1%1280, $itemAttributes)): ?> - card1%1280]) ?> + is_forged && $item->element): ?> + element ?> name_japanese): ?> name_japanese) ?> @@ -396,6 +398,10 @@ slots): ?> slots . ']') ?> + options): ?> + options." Options]" ?> + showItemRandomOption($item, $idx, '0-') ?> + @@ -493,37 +493,39 @@ - + $cart_item): ?> iconImage($cart_item->nameid) ?> - + bound) echo ' class="bound-item"' ?>> - cardsOver) echo ' class="overslotted' . $item->cardsOver . '"'; else echo ' class="normalslotted"' ?>> + cardsOver) echo ' class="overslotted' . $cart_item->cardsOver . '"'; else echo ' class="normalslotted"' ?>> refine > 0): ?> +refine) ?> - card0 == 255 && intval($cart_item->card1/1280) > 0): ?> - card1/1280); ?> - - Very - - Strong + forged_prefix): ?> + forged_prefix ?> - card0 == 254 || $cart_item->card0 == 255): ?> + is_forged || $cart_item->is_creation): ?> char_name): ?> actionAllowed('character', 'view') && ($isMine || (!$isMine && $auth->allowedToViewCharacter))): ?> linkToCharacter($cart_item->char_id, $cart_item->char_name, $session->serverName) . "'s" ?> - char_name . "'s") ?> + is_forged): ?> + char_name; ?>'s + is_creation): ?> + char_name; ?>'s + + char_name; ?>'s + 's - card0 == 255 && array_key_exists($item->card1%1280, $itemAttributes)): ?> - card1%1280]) ?> + is_forged && $cart_item->element): ?> + element ?> name_japanese): ?> name_japanese) ?> @@ -533,6 +535,10 @@ slots): ?> slots . ']') ?> + options): ?> + options." Options]" ?> + showItemRandomOption($cart_item, $idx, '1-') ?> + diff --git a/themes/default/css/flux.css b/themes/default/css/flux.css index 6901861f..bd1d2dd0 100644 --- a/themes/default/css/flux.css +++ b/themes/default/css/flux.css @@ -1087,3 +1087,76 @@ textarea { color: #ffba00; font-style: italic; } + +/* 0 z */ +.price-0 { + color: #1E1E1E; + text-shadow:1px 0px 0px #1E1E1E; +} +/* 1 z */ +.price-1 { + color:#00E2D7; + text-shadow:1px 0px 0px #00E2D7; +} +/* 10 z */ +.price-2 { + color:#862FEF; + text-shadow:1px 0px 0px #862FEF; +} +/* 100 z */ +.price-3 { + color:#115CDD; + text-shadow:1px 0px 0px #115CDD; +} +/* 1,000 z */ +.price-4 { + color:#B13500; + text-shadow:1px 0px 0px #B13500; +} +/* 10,000 z */ +.price-5 { + color:#C160C1; + text-shadow:1px 0px 0px #C160C1; +} +/* 100,000 z */ +.price-6 { + color:#1D1DB7; + text-shadow:1px 0px 0px #1D1DB7; +} +/* 1,000,000 z */ +.price-7 { + color:#208720; + text-shadow:1px 0px 0px #208720; +} +/* 10,000,000 z */ +.price-8 { + color:#903031; + text-shadow:1px 0px 0px #903031; +} +/* 100,000,000 z */ +.price-9 { + color:#A58700; + text-shadow:1px 0px 0px #A58700; +} +/* 1,000,000,000 z */ +.price-10 { + color:#FF1718; + text-shadow:1px 0px 0px #FF1718; +} + +.bound-item td { + background-color: #FCFFBF; +} + +.item-options-toggle { + cursor:pointer!important; +} + +ul.item-options { + padding:0 0 0 1.3em; +} + +.item-options li { + text-decoration:underline; +} + diff --git a/themes/default/footer.php b/themes/default/footer.php index d8604313..61ce5fda 100644 --- a/themes/default/footer.php +++ b/themes/default/footer.php @@ -57,5 +57,6 @@
IDNameItem IDName Price Amount
+ - actionAllowed('item', 'view')): ?> - $item->nameid)); ?>">item_name; ?> - - item_name ?> - - char_name): ?> - Of char_name ?> - - - price, 0, ',', ' '); ?> z + item_name ?> + + price, 0, '.', ','); ?> z + amount ?>
Card3 Extra
linkToItem($item->nameid, $item->nameid) ?> amount) ?> @@ -413,7 +419,7 @@ - card0 && ($item->type == 4 || $item->type == 5) && $item->card0 != 254 && $item->card0 != 255 && $item->card0 != -256): ?> + card0): ?> card0])): ?> linkToItem($item->card0, $cards[$item->card0]) ?> @@ -424,7 +430,7 @@ - card1 && ($item->type == 4 || $item->type == 5) && $item->card0 != 255 && $item->card0 != -256): ?> + card1): ?> card1])): ?> linkToItem($item->card1, $cards[$item->card1]) ?> @@ -435,7 +441,7 @@ - card2 && ($item->type == 4 || $item->type == 5) && $item->card0 != 254 && $item->card0 != 255 && $item->card0 != -256): ?> + card2): ?> card2])): ?> linkToItem($item->card2, $cards[$item->card2]) ?> @@ -446,7 +452,7 @@ - card3 && ($item->type == 4 || $item->type == 5) && $item->card0 != 254 && $item->card0 != 255 && $item->card0 != -256): ?> + card3): ?> card3])): ?> linkToItem($item->card3, $cards[$item->card3]) ?> @@ -457,16 +463,10 @@ - bound == 1):?> - Account Bound - bound == 2):?> - Guild Bound - bound == 3):?> - Party Bound - bound == 4):?> - Character Bound + bound):?> + get($item->bound)); ?> Bound - None + None
Extra
linkToItem($cart_item->nameid, $cart_item->nameid) ?> amount) ?> @@ -550,7 +556,7 @@ - card0 && ($cart_item->type == 4 || $cart_item->type == 5) && $cart_item->card0 != 254 && $cart_item->card0 != 255 && $cart_item->card0 != -256): ?> + card0): ?> card0])): ?> linkToItem($cart_item->card0, $cart_cards[$cart_item->card0]) ?> @@ -561,7 +567,7 @@ - card1 && ($cart_item->type == 4 || $cart_item->type == 5) && $cart_item->card0 != 255 && $cart_item->card0 != -256): ?> + card1): ?> card1])): ?> linkToItem($cart_item->card1, $cart_cards[$cart_item->card1]) ?> @@ -572,7 +578,7 @@ - card2 && ($cart_item->type == 4 || $cart_item->type == 5) && $cart_item->card0 != 254 && $cart_item->card0 != 255 && $cart_item->card0 != -256): ?> + card2): ?> card2])): ?> linkToItem($cart_item->card2, $cart_cards[$cart_item->card2]) ?> @@ -583,7 +589,7 @@ - card3 && ($cart_item->type == 4 || $cart_item->type == 5) && $cart_item->card0 != 254 && $cart_item->card0 != 255 && $cart_item->card0 != -256): ?> + card3): ?> card3])): ?> linkToItem($cart_item->card3, $cart_cards[$cart_item->card3]) ?> @@ -594,16 +600,10 @@ - bound == 1):?> - Account Bound - bound == 2):?> - Guild Bound - bound == 3):?> - Party Bound - bound == 4):?> - Character Bound + bound):?> + get($cart_item->bound)); ?> Bound - None + None
+ diff --git a/themes/default/header.php b/themes/default/header.php index 8b877764..3710a5f2 100644 --- a/themes/default/header.php +++ b/themes/default/header.php @@ -8,6 +8,7 @@ <?php echo Flux::config('SiteTitle'); if (isset($title)) echo ": $title" ?> + diff --git a/themes/default/vending/index.php b/themes/default/vending/index.php index e09e9447..1fd3d3ec 100644 --- a/themes/default/vending/index.php +++ b/themes/default/vending/index.php @@ -1,63 +1,151 @@ -

Vendors

+

- - infoText() ?> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +

Search...

+ + moduleActionFormInputs($params->get('module')) ?> +

+ + + ... + + + ... + + + ... + + +

+ - - -
sortableColumn('id', 'Vendor ID') ?> sortableColumn('char_name', 'Vendor Name') ?>TitlesortableColumn('map', 'Map') ?>XYGender
- actionAllowed('vending', 'viewshop')): ?> - $vending->id)); ?>">id; ?> - - id ?> - - char_name; ?> - - actionAllowed('vending', 'viewshop')): ?> - $vending->id)); ?>">title; ?> - - title ?> - - - map ?> - - x ?> - - y ?> - - sex ?> -
- getHTML() ?> + + infoText() ?> + + + + + + + + + + + + + + + + $item): ?> + iconImage($item->nameid) ?> + bound) echo ' class="bound-item"' ?>> + + + + + cardsOver) echo ' class="overslotted' . $item->cardsOver . '"'; else echo ' class="normalslotted"' ?>> + refine > 0): ?> + +refine) ?> + + forged_prefix): ?> + forged_prefix ?> + + is_forged || $item->is_creation): ?> + char_name): ?> + account_id == $session->account->account_id); ?> + actionAllowed('character', 'view') && ($isMine || (!$isMine && $auth->allowedToViewCharacter))): ?> + linkToCharacter($item->char_id, $item->char_name, $session->serverName) . "'s" ?> + + is_forged): ?> + char_name; ?>'s + is_creation): ?> + char_name; ?>'s + + char_name; ?>'s + + + + 's + + + is_forged && $item->element): ?> + element ?> + + name_japanese): ?> + name_japanese) ?> + + Unknown Item + + slots): ?> + slots . ']') ?> + + options): ?> + options." Options]" ?> + showItemRandomOption($item, $idx) ?> + + + + + + + + + + + + +
sortableColumn('nameid', 'ID') ?>sortableColumn('name_japanese', 'Name') ?>Card0Card1Card2Card3sortableColumn('price', 'Price') ?>AmountShop Name
linkToItem($item->nameid, $item->nameid) ?> + card0): ?> + card0])): ?> + linkToItem($item->card0, $cards[$item->card0]) ?> + + linkToItem($item->card0, $item->card0) ?> + + + None + + + card1): ?> + card1])): ?> + linkToItem($item->card1, $cards[$item->card1]) ?> + + linkToItem($item->card1, $item->card1) ?> + + + None + + + card2): ?> + card2])): ?> + linkToItem($item->card2, $cards[$item->card2]) ?> + + linkToItem($item->card2, $item->card2) ?> + + + None + + + card3): ?> + card3])): ?> + linkToItem($item->card3, $cards[$item->card3]) ?> + + linkToItem($item->card3, $item->card3) ?> + + + None + + + price, 0, '.', ','); ?> z + + amount ?> + + actionAllowed('vending', 'viewshop')): ?> + $item->vending_id)); ?>">title; ?> + + title ?> + +
+getHTML() ?> -

No Vendors found. Go back.

+

No Items found. Go back.

diff --git a/themes/default/vending/vendors.php b/themes/default/vending/vendors.php new file mode 100644 index 00000000..418d2d37 --- /dev/null +++ b/themes/default/vending/vendors.php @@ -0,0 +1,87 @@ + +

+ +

Search...

+
+ moduleActionFormInputs($params->get('module')) ?> +

+ + + ... + + + ... + + + ... + + +

+
+ + + infoText() ?> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
sortableColumn('vending_id', 'ID') ?> sortableColumn('name', 'Vendor Name') ?>sortableColumn('title', 'Title') ?>sortableColumn('map', 'Map') ?>XYGender
+ actionAllowed('vending', 'viewshop')): ?> + $vending->vending_id)); ?>">vending_id; ?> + + vending_id ?> + + + actionAllowed('character', 'view') && $auth->allowedToViewCharacter): ?> + linkToCharacter($vending->char_id, $vending->name); ?> + + name; ?> + + + + actionAllowed('vending', 'viewshop')): ?> + $vending->vending_id)); ?>">title; ?> + + title ?> + + + map ?> + + x ?> + + y ?> + + sex ?> +
+getHTML() ?> + +

No Vendors found. Go back.

+ diff --git a/themes/default/vending/viewshop.php b/themes/default/vending/viewshop.php index aaca8963..181f8463 100644 --- a/themes/default/vending/viewshop.php +++ b/themes/default/vending/viewshop.php @@ -4,143 +4,120 @@

title ?>

map; ?>, x; ?>, y; ?>

- + - - - - + + - - + + - - - - - - - - - - - - - - - - - - - - - + $item): ?> + iconImage($item->nameid) ?> + bound) echo ' class="bound-item"' ?>> + + + + + cardsOver) echo ' class="overslotted' . $item->cardsOver . '"'; else echo ' class="normalslotted"' ?>> + refine > 0): ?> + +refine) ?> + + forged_prefix): ?> + forged_prefix ?> + + is_forged || $item->is_creation): ?> + char_name): ?> + actionAllowed('character', 'view') && ($isMine || (!$isMine && $auth->allowedToViewCharacter))): ?> + linkToCharacter($item->char_id, $item->char_name, $session->serverName) . "'s" ?> + + is_forged): ?> + char_name; ?>'s + is_creation): ?> + char_name; ?>'s + + char_name; ?>'s + + + + 's + + + is_forged && $item->element): ?> + element ?> + + name_japanese): ?> + name_japanese) ?> + + Unknown Item + + slots): ?> + slots . ']') ?> + + options): ?> + options." Options]" ?> + showItemRandomOption($item, $idx) ?> + + + + + + + + + +
IDNameRefineSlotItem IDItem Name Card0 Card1 Card2 Card3PriceAmountPriceAmount
- - actionAllowed('item', 'view')): ?> - $item->nameid)); ?>">nameid; ?> - - nameid ?> - - - - - - - actionAllowed('item', 'view')): ?> - $item->nameid)); ?>">item_name; ?> - - item_name ?> - - char_name): ?> - Of char_name ?> - - - - - refine > 0): ?> - - refine ?> - - - card0 == 255 && intval($item->card1 / 1280) > 0): ?> - card1/1280); ?> - - Very - - Strong - - - card0 == 254 || $item->card0 == 255): ?> - char_name): ?> - actionAllowed('character', 'view') && ($isMine || (!$isMine && $auth->allowedToViewCharacter))): ?> - linkToCharacter($item->char_id, $item->char_name, $session->serverName) . "'s" ?> - - char_name . "'s") ?> - - - 's - - - - card0 == 255 && array_key_exists($item->card1 % 1280, $itemAttributes)): ?> - card1 % 1280]) ?> - - - slots): ?> - slots . ']') ?> - - - card0 && ($item->type == 4 || $item->type == 5) && $item->card0 != 254 && $item->card0 != 255 && $item->card0 != -256): ?> - card0])): ?> - linkToItem($item->card0, $cards[$item->card0]) ?> - - linkToItem($item->card0, $item->card0) ?> - - - None - - - card1 && ($item->type == 4 || $item->type == 5) && $item->card0 != 255 && $item->card0 != -256): ?> - card1])): ?> - linkToItem($item->card1, $cards[$item->card1]) ?> - - linkToItem($item->card1, $item->card1) ?> - - - None - - - card2 && ($item->type == 4 || $item->type == 5) && $item->card0 != 254 && $item->card0 != 255 && $item->card0 != -256): ?> - card2])): ?> - linkToItem($item->card2, $cards[$item->card2]) ?> - - linkToItem($item->card2, $item->card2) ?> - - - None - - - card3 && ($item->type == 4 || $item->type == 5) && $item->card0 != 254 && $item->card0 != 255 && $item->card0 != -256): ?> - card3])): ?> - linkToItem($item->card3, $cards[$item->card3]) ?> - - linkToItem($item->card3, $item->card3) ?> - - - None - - - price, 0, ',', ' '); ?> z - - amount ?> -
linkToItem($item->nameid, $item->nameid) ?> + card0): ?> + card0])): ?> + linkToItem($item->card0, $cards[$item->card0]) ?> + + linkToItem($item->card0, $item->card0) ?> + + + None + + + card1): ?> + card1])): ?> + linkToItem($item->card1, $cards[$item->card1]) ?> + + linkToItem($item->card1, $item->card1) ?> + + + None + + + card2): ?> + card2])): ?> + linkToItem($item->card2, $cards[$item->card2]) ?> + + linkToItem($item->card2, $item->card2) ?> + + + None + + + card3): ?> + card3])): ?> + linkToItem($item->card3, $cards[$item->card3]) ?> + + linkToItem($item->card3, $item->card3) ?> + + + None + + + price, 0, '.', ','); ?> z + + amount ?> +
From febdd3c39ce091901fa27039215019b4527c0b10 Mon Sep 17 00:00:00 2001 From: Cydh Ramdh Date: Sat, 23 Jun 2018 06:57:06 +0700 Subject: [PATCH 02/11] Added 'Beloved' label for renamed pet --- lang/en_us.php | 1 + lib/Flux/Item.php | 1 + themes/default/account/view.php | 3 +++ themes/default/character/view.php | 6 ++++++ themes/default/vending/index.php | 3 +++ themes/default/vending/viewshop.php | 3 +++ 6 files changed, 17 insertions(+) diff --git a/lang/en_us.php b/lang/en_us.php index 65c2067d..b5b0304c 100755 --- a/lang/en_us.php +++ b/lang/en_us.php @@ -60,6 +60,7 @@ 'BoundCharacterLabel' => 'Character', 'ForgedWeaponVeryLabel' => 'Very', 'ForgedWeaponStrongLabel' => 'Strong', + 'PetRanamedLabel' => 'Beloved', //SIDEBAR //FluxCP Menu Items diff --git a/lib/Flux/Item.php b/lib/Flux/Item.php index ca85e0ab..8422b394 100644 --- a/lib/Flux/Item.php +++ b/lib/Flux/Item.php @@ -174,6 +174,7 @@ public function prettyPrint($items, Flux_Template $tmp = null) { if ($item->card0 == $this->item_egg_flag) { $item->is_egg = true; + $item->egg_renamed = $item->card3; } $item->card0 = $item->card1 = $item->card2 = $item->card3 = 0; diff --git a/themes/default/account/view.php b/themes/default/account/view.php index 7f731a61..195cb274 100644 --- a/themes/default/account/view.php +++ b/themes/default/account/view.php @@ -309,6 +309,9 @@ class="block-link"> is_forged && $item->element): ?> element ?> + is_egg && $item->egg_renamed): ?> + + name_japanese): ?> name_japanese) ?> diff --git a/themes/default/character/view.php b/themes/default/character/view.php index c8b9b9a3..68115a16 100644 --- a/themes/default/character/view.php +++ b/themes/default/character/view.php @@ -390,6 +390,9 @@ is_forged && $item->element): ?> element ?> + is_egg && $item->egg_renamed): ?> + + name_japanese): ?> name_japanese) ?> @@ -527,6 +530,9 @@ is_forged && $cart_item->element): ?> element ?> + is_egg && $cart_item->egg_renamed): ?> + + name_japanese): ?> name_japanese) ?> diff --git a/themes/default/vending/index.php b/themes/default/vending/index.php index 1fd3d3ec..7b42ccf3 100644 --- a/themes/default/vending/index.php +++ b/themes/default/vending/index.php @@ -71,6 +71,9 @@ is_forged && $item->element): ?> element ?> + is_egg && $item->egg_renamed): ?> + + name_japanese): ?> name_japanese) ?> diff --git a/themes/default/vending/viewshop.php b/themes/default/vending/viewshop.php index 181f8463..2e53b260 100644 --- a/themes/default/vending/viewshop.php +++ b/themes/default/vending/viewshop.php @@ -53,6 +53,9 @@ is_forged && $item->element): ?> element ?> + is_egg && $item->egg_renamed): ?> + + name_japanese): ?> name_japanese) ?> From c96c0cd272ff7e91ea7817ac6ee5a2282d0ce4e9 Mon Sep 17 00:00:00 2001 From: Cydh Ramdh Date: Sat, 23 Jun 2018 08:50:12 +0700 Subject: [PATCH 03/11] Added random option info in Guild Storage --- lib/Flux/Item.php | 9 ++-- modules/account/view.php | 2 +- modules/character/view.php | 4 +- modules/guild/view.php | 58 ++++++---------------- modules/vending/viewshop.php | 2 +- themes/default/guild/view.php | 92 +++++++++++++++++++---------------- 6 files changed, 76 insertions(+), 91 deletions(-) diff --git a/lib/Flux/Item.php b/lib/Flux/Item.php index 8422b394..8389a007 100644 --- a/lib/Flux/Item.php +++ b/lib/Flux/Item.php @@ -50,13 +50,16 @@ public function __construct(Flux_Athena $server, $main_table = '', $column_id = $this->table = "items"; $this->table_database = "`{$server->charMapDatabase}`.".$this->table; - $this->select_string = ",".$this->table.".`name_japanese`,".$this->table.".`type`,".$this->table.".`slots` ".$this->random_options_select; + $char_table_name = "c"; + $this->select_string = ",".$this->table.".`name_japanese`,".$this->table.".`type`,".$this->table.".`slots`"; + $this->select_string .= ",".$char_table_name.".`char_id`,".$char_table_name.".`name` AS char_name"; + $this->select_string .= $this->random_options_select." "; $this->join_string_tmp = "LEFT JOIN ".$this->table_database." ON `%s`.`%s` = `".$this->table."`.id "; $special = Flux::config('ItemSpecial'); - $this->named_item_string_tmp = "LEFT JOIN {$server->charMapDatabase}.`char` AS c "; - $this->named_item_string_tmp .= "ON c.char_id = IF(%s.`card0` IN ('".$special->get('forge')."', '".$special->get('create')."'), "; + $this->named_item_string_tmp = "LEFT JOIN {$server->charMapDatabase}.`char` AS ".$char_table_name." "; + $this->named_item_string_tmp .= "ON ".$char_table_name.".char_id = IF(%s.`card0` IN ('".$special->get('forge')."', '".$special->get('create')."'), "; $this->named_item_string_tmp .= "IF(%s.`card2` < 0, %s.`card2` + 65536, %s.`card2`) "; $this->named_item_string_tmp .= "| (%s.`card3` << 16), NULL) "; diff --git a/modules/account/view.php b/modules/account/view.php index 023f6577..9a9114dd 100644 --- a/modules/account/view.php +++ b/modules/account/view.php @@ -163,7 +163,7 @@ } if ($account) { - $sql = "SELECT storage.*,c.`char_id`,c.name AS char_name "; + $sql = "SELECT storage.* "; $sql .= $itemLib->select_string; $sql .= "FROM {$server->charMapDatabase}.storage "; $sql .= $itemLib->join_string; diff --git a/modules/character/view.php b/modules/character/view.php index 1ad3a7c9..8ad6e41b 100644 --- a/modules/character/view.php +++ b/modules/character/view.php @@ -116,7 +116,7 @@ $partyMembers = array(); } - $sql = "SELECT inventory.*, c.char_id, c.name AS char_name"; + $sql = "SELECT inventory.* "; $sql .= $itemLib->select_string; $sql .= "FROM {$server->charMapDatabase}.inventory "; $sql .= $itemLib->getJoinString('inventory','nameid'); @@ -155,7 +155,7 @@ } } - $sql = "SELECT cart_inventory.*, c.char_id, c.name AS char_name "; + $sql = "SELECT cart_inventory.* "; $sql .= $itemLib->select_string; $sql .= "FROM {$server->charMapDatabase}.cart_inventory "; $sql .= $itemLib->getJoinString('cart_inventory','nameid'); diff --git a/modules/guild/view.php b/modules/guild/view.php index 1a9cfe75..4d4170a7 100644 --- a/modules/guild/view.php +++ b/modules/guild/view.php @@ -5,6 +5,7 @@ $title = 'Viewing Guild'; +require_once 'Flux/Item.php'; require_once 'Flux/TemporaryTable.php'; if($server->isRenewal) { @@ -12,8 +13,8 @@ } else { $fromTables = array("{$server->charMapDatabase}.item_db", "{$server->charMapDatabase}.item_db2"); } -$tableName = "{$server->charMapDatabase}.items"; -$tempTable = new Flux_TemporaryTable($server->connection, $tableName, $fromTables); +$itemLib = new Flux_Item($server, 'guild_storage', 'nameid'); +$tempTable = new Flux_TemporaryTable($server->connection, $itemLib->table_database, $fromTables); $guildID = $params->get('id'); @@ -100,22 +101,19 @@ $expulsions = $sth->fetchAll(); if (!Flux::config('GStorageLeaderOnly') || $amOwner || $auth->allowedToViewGuild) { - $col = "guild_storage.*, items.name_japanese, items.type, items.slots, c.char_id, c.name AS char_name"; - - $sql = "SELECT $col FROM {$server->charMapDatabase}.guild_storage "; - $sql .= "LEFT JOIN {$server->charMapDatabase}.items ON items.id = guild_storage.nameid "; - $sql .= "LEFT JOIN {$server->charMapDatabase}.`char` AS c "; - $sql .= "ON c.char_id = IF(guild_storage.card0 IN (254, 255), "; - $sql .= "IF(guild_storage.card2 < 0, guild_storage.card2 + 65536, guild_storage.card2) "; - $sql .= "| (guild_storage.card3 << 16), NULL) "; - $sql .= "WHERE guild_storage.guild_id = ? "; + $sql = "SELECT `guild_storage`.* "; + $sql .= $itemLib->select_string; + $sql .= "FROM {$server->charMapDatabase}.guild_storage "; + $sql .= $itemLib->join_string; + $sql .= $itemLib->named_item_string; + $sql .= "WHERE `guild_storage`.`guild_id` = ?"; if (!$auth->allowedToSeeUnknownItems) { $sql .= 'AND guild_storage.identify > 0 '; } $sql .= "ORDER BY guild_storage.nameid ASC, guild_storage.identify DESC, "; - $sql .= "guild_storage.attribute ASC, guild_storage.refine ASC"; + $sql .= "guild_storage.attribute ASC, guild_storage.refine ASC "; $sth = $server->connection->getStatement($sql); $sth->execute(array($guildID)); @@ -124,39 +122,15 @@ $cards = array(); if ($items) { - $cardIDs = array(); - - foreach ($items as $item) { - $item->cardsOver = -$item->slots; - - if ($item->card0) { - $cardIDs[] = $item->card0; - $item->cardsOver++; - } - if ($item->card1) { - $cardIDs[] = $item->card1; - $item->cardsOver++; - } - if ($item->card2) { - $cardIDs[] = $item->card2; - $item->cardsOver++; - } - if ($item->card3) { - $cardIDs[] = $item->card3; - $item->cardsOver++; - } - - if ($item->card0 == 254 || $item->card0 == 255 || $item->card0 == -256 || $item->cardsOver < 0) { - $item->cardsOver = 0; - } - } - - if ($cardIDs) { - $ids = implode(',', array_fill(0, count($cardIDs), '?')); + $this->cardIDs = array(); + $items = $itemLib->prettyPrint($items, $this); + + if ($this->cardIDs) { + $ids = implode(',', array_fill(0, count($this->cardIDs), '?')); $sql = "SELECT id, name_japanese FROM {$server->charMapDatabase}.items WHERE id IN ($ids)"; $sth = $server->connection->getStatement($sql); - $sth->execute($cardIDs); + $sth->execute($this->cardIDs); $temp = $sth->fetchAll(); if ($temp) { foreach ($temp as $card) { diff --git a/modules/vending/viewshop.php b/modules/vending/viewshop.php index 7725e45e..30346a61 100644 --- a/modules/vending/viewshop.php +++ b/modules/vending/viewshop.php @@ -36,7 +36,7 @@ // Get the vendor's items. // Get the current Vendor values. $sql = "SELECT (".$vending->account_id.") AS account_id, (".$vending->char_id.") AS char_id, `vending_items`.`cartinventory_id`, `vending_items`.`amount`, `vending_items`.`price`, "; - $sql .= "`ci`.`nameid`, `ci`.`refine`, `ci`.`card0`, `ci`.`card1`, `ci`.`card2`, `ci`.`card3`, c.`name` as char_name "; + $sql .= "`ci`.`nameid`, `ci`.`refine`, `ci`.`card0`, `ci`.`card1`, `ci`.`card2`, `ci`.`card3` "; $sql .= $itemLib->select_string; $sql .= "FROM vending_items "; $sql .= "LEFT JOIN `cart_inventory` ci on `vending_items`.cartinventory_id = `ci`.id "; diff --git a/themes/default/guild/view.php b/themes/default/guild/view.php index da55d4f1..c7971d13 100644 --- a/themes/default/guild/view.php +++ b/themes/default/guild/view.php @@ -210,22 +210,27 @@

name) ?> has guild storage item(s).

- - - - - - - - - + + + + + + + + + - - + $item): ?> iconImage($item->nameid) ?> - - + bound) echo ' class="bound-item"' ?>> + @@ -233,53 +238,62 @@ refine > 0): ?> +refine) ?> - card0 == 255 && intval($item->card1/1280) > 0): ?> - card1/1280); ?> - - Very - - Strong + forged_prefix): ?> + forged_prefix ?> - card0 == 254 || $item->card0 == 255): ?> + is_forged || $item->is_creation): ?> char_name): ?> actionAllowed('character', 'view') && ($isMine || (!$isMine && $auth->allowedToViewCharacter))): ?> linkToCharacter($item->char_id, $item->char_name, $session->serverName) . "'s" ?> - char_name . "'s") ?> + is_forged): ?> + char_name; ?>'s + is_creation): ?> + char_name; ?>'s + + char_name; ?>'s + 's - card0 == 255 && array_key_exists($item->card1%1280, $itemAttributes)): ?> - card1%1280]) ?> + is_forged && $item->element): ?> + element ?> + + is_egg && $item->egg_renamed): ?> + name_japanese): ?> name_japanese) ?> - Unknown Item + slots): ?> slots . ']') ?> + options): ?> + options." Options]" ?> + showItemRandomOption($item, $idx) ?> + From b4a8e445571cd28d5ca2ed2068a7405913fe715c Mon Sep 17 00:00:00 2001 From: Cydh Ramdh Date: Sat, 23 Jun 2018 20:19:31 +0700 Subject: [PATCH 04/11] Added info in picklog * Added random option * Added forged, creation, pet info --- lib/Flux/Item.php | 108 ++++++++++++++++------------ modules/buyingstore/buyers.php | 12 ++-- modules/buyingstore/index.php | 27 +++---- modules/logdata/pick.php | 124 +++++++++++++++++++++++++++----- modules/vending/index.php | 63 ++++++++-------- modules/vending/vendors.php | 10 +-- themes/default/logdata/pick.php | 83 ++++++++++++++++++++- 7 files changed, 311 insertions(+), 116 deletions(-) diff --git a/lib/Flux/Item.php b/lib/Flux/Item.php index 8389a007..2c0ca1c4 100644 --- a/lib/Flux/Item.php +++ b/lib/Flux/Item.php @@ -116,6 +116,55 @@ public function itemIsSpecial($card0) { return false; } + public function getCardsOver($item) { + $cardsOver = -$item->slots; + if ($item->card0) { + $item->cardsOver++; + } + if ($item->card1) { + $item->cardsOver++; + } + if ($item->card2) { + $item->cardsOver++; + } + if ($item->card3) { + $item->cardsOver++; + } + return $cardsOver; + } + + public function getItemSpecialValues($item) { + $itemAttributes = Flux::config('Attributes')->toArray(); + if ($item->card0 == $this->item_forge_flag) { + $item->slots = 0; + // $item->card1 holds of ((star_crumb_num*5)<<8) + element + // 1280 is value of if star_crumb_num = 1 + if (intval($item->card1/1280) > 0) { + $itemcard1 = intval($item->card1/1280); + $item->forged_prefix = ''; + for ($i = 0; $i < $itemcard1; $i++) + $item->forged_prefix .= Flux::message('ForgedWeaponVeryLabel').' '; + $item->forged_prefix .= Flux::message('ForgedWeaponStrongLabel').' '; + } + $item->is_forged = true; + + if (array_key_exists($item->card1%1280, $itemAttributes)) + $item->element = htmlspecialchars($itemAttributes[$item->card1%1280]); + } + + if ($item->card0 == $this->item_creation_flag) { + $item->is_creation = true; + } + + if ($item->card0 == $this->item_egg_flag) { + $item->is_egg = true; + $item->egg_renamed = $item->card3; + } + + $item->card0 = $item->card1 = $item->card2 = $item->card3 = 0; + return $item; + } + /** * Check if card0 slot is used for flag of forged, creation, or pet egg item * @param $items List of items as result by table fetching @@ -123,26 +172,23 @@ public function itemIsSpecial($card0) { */ public function prettyPrint($items, Flux_Template $tmp = null) { $cardIDs = array(); - $itemAttributes = Flux::config('Attributes')->toArray(); foreach ($items as $item) { - $item->cardsOver = -$item->slots; + $item->cardsOver = self::getCardsOver($item); - if ($item->card0) { - $cardIDs[] = $item->card0; - $item->cardsOver++; - } - if ($item->card1) { - $cardIDs[] = $item->card1; - $item->cardsOver++; - } - if ($item->card2) { - $cardIDs[] = $item->card2; - $item->cardsOver++; - } - if ($item->card3) { - $cardIDs[] = $item->card3; - $item->cardsOver++; + if ($tmp) { + if ($item->card0) { + $cardIDs[] = $item->card0; + } + if ($item->card1) { + $cardIDs[] = $item->card1; + } + if ($item->card2) { + $cardIDs[] = $item->card2; + } + if ($item->card3) { + $cardIDs[] = $item->card3; + } } if (self::itemIsSpecial($item->card0) || $item->cardsOver < 0) { @@ -154,33 +200,7 @@ public function prettyPrint($items, Flux_Template $tmp = null) { if (!self::itemIsSpecial($item->card0)) continue; - if ($item->card0 == $this->item_forge_flag) { - $item->slots = 0; - // $item->card1 holds of ((star_crumb_num*5)<<8) + element - // 1280 is value of if star_crumb_num = 1 - if (intval($item->card1/1280) > 0) { - $itemcard1 = intval($item->card1/1280); - $item->forged_prefix = ''; - for ($i = 0; $i < $itemcard1; $i++) - $item->forged_prefix .= Flux::message('ForgedWeaponVeryLabel').' '; - $item->forged_prefix .= Flux::message('ForgedWeaponStrongLabel').' '; - } - $item->is_forged = true; - - if (array_key_exists($item->card1%1280, $itemAttributes)) - $item->element = htmlspecialchars($itemAttributes[$item->card1%1280]); - } - - if ($item->card0 == $this->item_creation_flag) { - $item->is_creation = true; - } - - if ($item->card0 == $this->item_egg_flag) { - $item->is_egg = true; - $item->egg_renamed = $item->card3; - } - - $item->card0 = $item->card1 = $item->card2 = $item->card3 = 0; + $item = self::getItemSpecialValues($item); } if ($tmp) diff --git a/modules/buyingstore/buyers.php b/modules/buyingstore/buyers.php index f1539853..5d7b30cc 100644 --- a/modules/buyingstore/buyers.php +++ b/modules/buyingstore/buyers.php @@ -27,9 +27,10 @@ } $buyingstore_table = 'buyingstores'; -$sql = "SELECT `$buyingstore_table`.id as buyid, `$buyingstore_table`.sex, `$buyingstore_table`.map, `$buyingstore_table`.x, `$buyingstore_table`.y, `$buyingstore_table`.title, autotrade "; -$sql .= ",`$buyingstore_table`.char_id,`char`.name "; -$sql .= "FROM `$buyingstore_table` "; +$col = "`$buyingstore_table`.id as buyid, `$buyingstore_table`.sex, `$buyingstore_table`.map, `$buyingstore_table`.x, `$buyingstore_table`.y, `$buyingstore_table`.title, autotrade "; +$col .= ",`$buyingstore_table`.char_id,`char`.name "; + +$sql = "FROM `$buyingstore_table` "; $sql .= "LEFT JOIN `char` on `$buyingstore_table`.`char_id` = `char`.char_id "; if (count($sql_params)) { $sql .= 'WHERE '.$sql_criteria; @@ -39,11 +40,12 @@ 'buyid' => 'ASC', 'name', 'map', 'title' ); -$sth = $server->connection->getStatement($sql); +$sth = $server->connection->getStatement("SELECT COUNT(`$buyingstore_table`.id) as total ".$sql); $sth->execute($sql_params); -$paginator = $this->getPaginator($sth->rowCount()); +$paginator = $this->getPaginator($sth->fetch()->total); $paginator->setSortableColumns($sortable); +$sql = "SELECT ".$col." ".$sql; $sql = $paginator->getSQL($sql); $sth = $server->connection->getStatement($sql); $sth->execute($sql_params); diff --git a/modules/buyingstore/index.php b/modules/buyingstore/index.php index d0864bb3..38f68ec3 100644 --- a/modules/buyingstore/index.php +++ b/modules/buyingstore/index.php @@ -18,9 +18,7 @@ $sql_criteria = ""; $sql_params = array(); if ($item) { - if (count($sql_params)) - $sql_criteria .= ' AND '; - $sql_criteria .= ' `item_name` LIKE ? OR `nameid`=?'; + $sql_criteria .= '(`name_japanese` LIKE ? OR item_id = ?)'; $sql_params[] = "%$item%"; $sql_params[] = $item; } @@ -28,27 +26,30 @@ $buyingstore_table = 'buyingstores'; $buyingstore_items_table = 'buyingstore_items'; -$sql = "SELECT `$buyingstore_table`.id as buyid, `$buyingstore_table`.sex, `$buyingstore_table`.map, `$buyingstore_table`.x, `$buyingstore_table`.y, `$buyingstore_table`.title, autotrade "; -$sql .= ",`$buyingstore_table`.char_id,`char`.name as char_name "; -$sql .= ",`$buyingstore_items_table`.`item_id` as nameid,`$buyingstore_items_table`.price,`$buyingstore_items_table`.amount"; -$sql .= ",`items`.`name_japanese` as item_name, `items`.`slots`, `items`.`type` "; -$sql .= "FROM `$buyingstore_table` "; -$sql .= "LEFT JOIN `char` on `$buyingstore_table`.`char_id` = `char`.char_id "; +$col = "`ch`.`char_id`,`ch`.`name` as char_name "; +$col .= ",`$buyingstore_table`.id as buyid, `$buyingstore_table`.sex, `$buyingstore_table`.map, `$buyingstore_table`.x, `$buyingstore_table`.y, `$buyingstore_table`.title, autotrade "; +$col .= ",`$buyingstore_items_table`.`item_id` as nameid,`$buyingstore_items_table`.price,`$buyingstore_items_table`.amount"; +$col .= ",items.`name_japanese` as item_name, items.`slots`, items.`type` "; + +$sql = "FROM `$buyingstore_table` "; +$sql .= "LEFT JOIN `char` ch on `$buyingstore_table`.`char_id` = `ch`.char_id "; $sql .= "LEFT JOIN `$buyingstore_items_table` on `$buyingstore_table`.`id`=`$buyingstore_items_table`.`buyingstore_id` "; -$sql .= "LEFT JOIN items on `$buyingstore_items_table`.item_id = items.id "; +$sql .= "LEFT JOIN items on `$buyingstore_items_table`.item_id = items.`id` "; if (count($sql_params)) { - $sql .= 'HAVING '.$sql_criteria; + $sql .= 'WHERE '.$sql_criteria; } $sortable = array( 'item_name' => 'ASC', 'nameid', 'price', 'title' ); -$sth = $server->connection->getStatement($sql); + +$sth = $server->connection->getStatement("SELECT COUNT(`ch`.`char_id`) as total ".$sql); $sth->execute($sql_params); -$paginator = $this->getPaginator($sth->rowCount()); +$paginator = $this->getPaginator($sth->fetch()->total); $paginator->setSortableColumns($sortable); +$sql = "SELECT ".$col." ".$sql; $sql = $paginator->getSQL($sql); $sth = $server->connection->getStatement($sql); $sth->execute($sql_params); diff --git a/modules/logdata/pick.php b/modules/logdata/pick.php index 541c45c2..b0c2dec1 100644 --- a/modules/logdata/pick.php +++ b/modules/logdata/pick.php @@ -1,11 +1,69 @@ logsDatabase}.picklog"; +$sql_param_str = ''; +$sql_params = array(); + +$char_id = $params->get('char_id'); +$nameid = $params->get('nameid'); +$map = $params->get('map'); +$card = $params->get('card'); +$datefrom = $params->get('datefrom'); +$dateto = $params->get('dateto'); + +if ($char_id) { + $sql_param_str = '`char_id`=?'; + $sql_params[] = $char_id; +} +if ($nameid) { + if (count($sql_params)) + $sql_param_str .= ' AND '; + $sql_param_str .= '`nameid`=?'; + $sql_params[] = $nameid; +} +if ($map) { + if (count($sql_params)) + $sql_param_str .= ' AND '; + $sql_param_str .= '`map` LIKE ?'; + $sql_params[] = "%$map%"; +} +if ($card) { + if (count($sql_params)) + $sql_param_str .= ' AND '; + $sql_param_str .= '(`card0`=? OR `card1`=? OR `card2`=? OR `card3`=?)'; + $sql_params[] = $card; + $sql_params[] = $card; + $sql_params[] = $card; + $sql_params[] = $card; +} +if ($datefrom || $dateto) { + if (count($sql_params)) + $sql_param_str .= ' AND '; + if ($datefrom && $dateto) { + $sql_param_str .= '`time` BETWEEN ? AND ?'; + $sql_params[] = $datefrom; + $sql_params[] = $dateto; + } + else if ($datefrom && !$dateto) { + $sql_param_str .= '`time` > ?'; + $sql_params[] = $datefrom; + } + else { + $sql_param_str .= '`time` < ?'; + $sql_params[] = $dateto; + } +} + +$sql = "SELECT COUNT(`id`) AS total FROM {$server->logsDatabase}.picklog"; +if (count($sql_params)) + $sql .= " WHERE ".$sql_param_str; $sth = $server->connection->getStatementForLogs($sql); -$sth->execute(); +$sth->execute($sql_params); $paginator = $this->getPaginator($sth->fetch()->total); $paginator->setSortableColumns(array( @@ -13,10 +71,14 @@ 'refine', 'card0', 'card1', 'card2', 'card3', 'map' )); -$col = "time, char_id, type, nameid, amount, refine, card0, card1, card2, card3, map"; -$sql = $paginator->getSQL("SELECT $col FROM {$server->logsDatabase}.picklog"); +$sql = "SELECT `time`, `char_id`, `type`, `nameid`, `amount`, `refine`, `card0`, `card1`, `card2`, `card3`,`map`"; +$sql .= ",`bound`,`unique_id` ".$itemLib->random_options_select; +$sql .= "FROM {$server->logsDatabase}.picklog"; +if (count($sql_params)) + $sql .= " WHERE ".$sql_param_str; +$sql = $paginator->getSQL($sql); $sth = $server->connection->getStatementForLogs($sql); -$sth->execute(); +$sth->execute($sql_params); $picks = $sth->fetchAll(); @@ -24,6 +86,7 @@ $charIDs = array(); $itemIDs = array(); $mobIDs = array(); + $creatorIDs = array(); $pickTypes = Flux::config('PickTypes'); foreach ($picks as $pick) { @@ -36,21 +99,50 @@ $charIDs[$pick->char_id] = null; } - if ($pick->card0) { - $itemIDs[$pick->card0] = null; - } - if ($pick->card1) { - $itemIDs[$pick->card1] = null; - } - if ($pick->card2) { - $itemIDs[$pick->card2] = null; + if (!$itemLib->itemIsSpecial($pick->card0)) { + $pick->cardsOver = $itemLib->getCardsOver($pick); + if ($pick->cardsOver < 0) { + $pick->cardsOver = 0; + } + if ($pick->card0) { + $itemIDs[$pick->card0] = null; + } + if ($pick->card1) { + $itemIDs[$pick->card1] = null; + } + if ($pick->card2) { + $itemIDs[$pick->card2] = null; + } + if ($pick->card3) { + $itemIDs[$pick->card3] = null; + } + $pick->special = 0; } - if ($pick->card3) { - $itemIDs[$pick->card3] = null; + else { + $pick->cardsOver = 0; + $pick->creator_char_id = (($pick->card3<<16)|$pick->card2); + $creatorIDs[$pick->creator_char_id] = null; + $pick = $itemLib->getItemSpecialValues($pick); + $pick->special = 1; } - + + $pick->options = ($itemLib->random_options_enabled ? $itemLib->itemHasOptions($pick) : 0); $pick->pick_type = $pickTypes->get($pick->type); } + + if ($creatorIDs) { + $ids = array_keys($creatorIDs); + $sql = "SELECT `char_id`, `name` FROM {$server->charMapDatabase}.`char` WHERE `char_id` IN (".implode(',', array_fill(0, count($creatorIDs), '?')).")"; + $sth = $server->connection->getStatement($sql); + $sth->execute($ids); + + $ids = $sth->fetchAll(); + + // Map char_id to name. + foreach ($ids as $id) { + $creatorIDs[$id->char_id] = $id->name; + } + } if ($charIDs) { $ids = array_keys($charIDs); diff --git a/modules/vending/index.php b/modules/vending/index.php index e0445a8e..c8b5a535 100644 --- a/modules/vending/index.php +++ b/modules/vending/index.php @@ -19,64 +19,61 @@ $refine = trim($params->get('refine')); $card = trim($params->get('card')); -$sql_criteria1 = ""; -$sql_criteria2 = ""; -$sql_params1 = array(); -$sql_params2 = array(); +$sql_criteria = ""; +$sql_params = array(); if ($refine) { - $sql_criteria1 .= '`ci`.`refine`=?'; - $sql_params1[] = $refine; + $sql_criteria .= '`ci`.`refine`=?'; + $sql_params[] = $refine; } if ($card) { - if (count($sql_params1)) - $sql_criteria1 .= ' AND '; - $sql_criteria1 .= '(`ci`.`card0`=? OR `ci`.`card1`=? OR `ci`.`card2`=? OR `ci`.`card3`=?) '; - $sql_params1[] = $card; - $sql_params1[] = $card; - $sql_params1[] = $card; - $sql_params1[] = $card; + if (count($sql_params)) + $sql_criteria .= ' AND '; + $sql_criteria .= '(`ci`.`card0`=? OR `ci`.`card1`=? OR `ci`.`card2`=? OR `ci`.`card3`=?) '; + $sql_params[] = $card; + $sql_params[] = $card; + $sql_params[] = $card; + $sql_params[] = $card; } if ($item) { - if (count($sql_params2)) - $sql_criteria2 .= ' AND '; - $sql_criteria2 .= ' `name_japanese` LIKE ? OR `nameid`=?'; - $sql_params2[] = "%$item%"; - $sql_params2[] = $item; + if (count($sql_params)) + $sql_criteria .= ' AND '; + $sql_criteria .= ' `name_japanese` LIKE ? OR `nameid`=?'; + $sql_params[] = "%$item%"; + $sql_params[] = $item; } $vending_table = 'vendings'; $vending_items_table = 'vending_items'; -$sql = "SELECT `ch`.char_id, `ch`.name as char_name, `$vending_table`.id as vending_id, `$vending_table`.account_id, `$vending_table`.sex, `$vending_table`.map, `$vending_table`.x, `$vending_table`.y, `$vending_table`.title, autotrade "; -$sql .= ",`$vending_items_table`.`cartinventory_id`,`$vending_items_table`.`amount`,`$vending_items_table`.`price`"; -$sql .= ",ci.`nameid`,ci.`refine`,ci.`card0`,ci.`card1`,ci.`card2`,ci.`card3`"; -$sql .= $itemLib->select_string; -$sql .= "FROM `$vending_items_table` "; -$sql .= "LEFT JOIN `$vending_table` ON `$vending_items_table`.vending_id = `$vending_table`.id "; +$col = "`ch`.char_id, `ch`.name as char_name, `$vending_table`.id as vending_id, `$vending_table`.account_id, `$vending_table`.sex, `$vending_table`.map, `$vending_table`.x, `$vending_table`.y, `$vending_table`.title, autotrade "; +$col .= ",`$vending_items_table`.`cartinventory_id`,`$vending_items_table`.`amount`,`$vending_items_table`.`price`"; +$col .= ",ci.`nameid`,ci.`refine`,ci.`card0`,ci.`card1`,ci.`card2`,ci.`card3`"; +$col .= $itemLib->select_string; +$sql = "FROM `$vending_items_table` "; +$sql .= "LEFT JOIN `$vending_table` ON `$vending_items_table`.vending_id = `$vending_table`.id "; $sql .= "LEFT JOIN `cart_inventory` ci ON `$vending_items_table`.`cartinventory_id` = `ci`.id "; $sql .= "LEFT JOIN `char` ch ON `$vending_table`.char_id = `ch`.char_id "; $sql .= $itemLib->getJoinString('ci','nameid'); $sql .= $itemLib->getNamedItemString('ci'); -if (count($sql_params1)) { - $sql .= 'WHERE '.$sql_criteria1; -} -if (count($sql_params2)) { - $sql .= 'HAVING '.$sql_criteria2; +if (count($sql_params)) { + $sql .= 'WHERE '.$sql_criteria; } $sortable = array( 'name_japanese' => 'ASC', 'nameid', 'price', 'amount' ); -$sth = $server->connection->getStatement($sql); -$sth->execute(array_merge($sql_params1,$sql_params2)); -$paginator = $this->getPaginator($sth->rowCount()); + +$sth = $server->connection->getStatement("SELECT COUNT(`ch`.`char_id`) as total ".$sql); +$sth->execute($sql_params); +$paginator = $this->getPaginator($sth->fetch()->total); $paginator->setSortableColumns($sortable); +$sql = "SELECT ".$col." ".$sql; $sql = $paginator->getSQL($sql); $sth = $server->connection->getStatement($sql); -$sth->execute(array_merge($sql_params1,$sql_params2)); +$sth->execute($sql_params); $items = $sth->fetchAll(); diff --git a/modules/vending/vendors.php b/modules/vending/vendors.php index 6e1a5608..b9834c45 100644 --- a/modules/vending/vendors.php +++ b/modules/vending/vendors.php @@ -27,8 +27,9 @@ } $vending_table = 'vendings'; -$sql = "SELECT `ch`.char_id, `ch`.name, `$vending_table`.id as vending_id, `$vending_table`.account_id, `$vending_table`.sex, `$vending_table`.map, `$vending_table`.x, `$vending_table`.y, `$vending_table`.title, autotrade "; -$sql .= "FROM `$vending_table` "; +$col = "`ch`.char_id, `ch`.name, `$vending_table`.id as vending_id, `$vending_table`.account_id, `$vending_table`.sex, `$vending_table`.map, `$vending_table`.x, `$vending_table`.y, `$vending_table`.title, autotrade "; + +$sql = "FROM `$vending_table` "; $sql .= "LEFT JOIN `char` ch ON `$vending_table`.char_id = `ch`.char_id "; if (count($sql_params)) { @@ -39,11 +40,12 @@ 'vending_id' => 'ASC', 'map', 'name', 'title' ); -$sth = $server->connection->getStatement($sql); +$sth = $server->connection->getStatement("SELECT COUNT(`ch`.`char_id`) as total ".$sql); $sth->execute($sql_params); -$paginator = $this->getPaginator($sth->rowCount()); +$paginator = $this->getPaginator($sth->fetch()->total); $paginator->setSortableColumns($sortable); +$sql = "SELECT ".$col." ".$sql; $sql = $paginator->getSQL($sql); $sth = $server->connection->getStatement($sql); $sth->execute($sql_params); diff --git a/themes/default/logdata/pick.php b/themes/default/logdata/pick.php index 78334a3c..de72551a 100644 --- a/themes/default/logdata/pick.php +++ b/themes/default/logdata/pick.php @@ -1,5 +1,33 @@

+ +

Search...

+
+ moduleActionFormInputs($params->get('module')) ?> +

+ + + ... + + + ... + + + ... + + +
+ + + ... + + + ... + + +

+ + infoText() ?>
Item IDNameAmountIdentifiedBrokenCard0Card1Card2Card3 Extra
linkToItem($item->nameid, $item->nameid) ?> + actionAllowed('item', 'view')): ?> + linkToItem($item->nameid, $item->nameid) ?> + + nameid) ?> + + amount) ?> identify): ?> - Yes + - No + attribute): ?> - Yes + - No + - card0 && ($item->type == 4 || $item->type == 5) && $item->card0 != 254 && $item->card0 != 255 && $item->card0 != -256): ?> + card0): ?> card0])): ?> linkToItem($item->card0, $cards[$item->card0]) ?> @@ -290,7 +304,7 @@ - card1 && ($item->type == 4 || $item->type == 5) && $item->card0 != 255 && $item->card0 != -256): ?> + card1): ?> card1])): ?> linkToItem($item->card1, $cards[$item->card1]) ?> @@ -301,7 +315,7 @@ - card2 && ($item->type == 4 || $item->type == 5) && $item->card0 != 254 && $item->card0 != 255 && $item->card0 != -256): ?> + card2): ?> card2])): ?> linkToItem($item->card2, $cards[$item->card2]) ?> @@ -312,7 +326,7 @@ - card3 && ($item->type == 4 || $item->type == 5) && $item->card0 != 254 && $item->card0 != 255 && $item->card0 != -256): ?> + card3): ?> card3])): ?> linkToItem($item->card3, $cards[$item->card3]) ?> @@ -323,17 +337,11 @@ - bound == 1):?> - Account Bound - bound == 2):?> - Guild Bound - bound == 3):?> - Party Bound - bound == 4):?> - Character Bound - + bound):?> + get($item->bound)); ?> Bound + None - +
@@ -16,7 +44,7 @@ - + $pick): ?> + + special): ?> + + + + + options): ?> + + + +
sortableColumn('card3', Flux::message('PickLogCard3Label')) ?> sortableColumn('map', Flux::message('PickLogMapLabel')) ?>
formatDateTime($pick->time) ?> @@ -77,9 +105,14 @@ + options): ?> + options.">" ?> + amount >= 0 ? '+'.number_format($pick->amount) : number_format($pick->amount) ?> refine ?> card0_name): ?> @@ -152,6 +185,38 @@ + is_forged || $pick->is_creation): ?> + + forged_prefix): ?> + forged_prefix) ?> + + + creator_char_id, $creatorIDs) && $creatorIDs[$pick->creator_char_id]): ?> + creator_char_id] ?> + + creator_char_id."]" ?> + + actionAllowed('character', 'view') && $auth->allowedToViewCharacter): ?> + linkToCharacter($pick->char_id, $dispcharname, $session->serverName); ?> + + 's + + element): ?> + element) ?> + + + is_egg): ?> + + egg_renamed): ?> + + + + + map): ?> map, '.gat')) ?> @@ -160,6 +225,22 @@
getHTML() ?> From 8fb82b1b71fc1690ed439c3ee713fdb470957aac Mon Sep 17 00:00:00 2001 From: Cydh Ramdh Date: Sat, 23 Jun 2018 20:27:09 +0700 Subject: [PATCH 05/11] Follow up 68c7803a7017651546c69ef79f2e59f5dbee3566 * Added bound info in picklog --- themes/default/logdata/pick.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/themes/default/logdata/pick.php b/themes/default/logdata/pick.php index de72551a..681e23ea 100644 --- a/themes/default/logdata/pick.php +++ b/themes/default/logdata/pick.php @@ -106,7 +106,10 @@ options): ?> - options.">" ?> + options.">" ?> + + bound): ?> + <B> amount >= 0 ? '+'.number_format($pick->amount) : number_format($pick->amount) ?> From 79670e798992fc624005f3d4aeddb72e59002771 Mon Sep 17 00:00:00 2001 From: Cydh Ramdh Date: Mon, 2 Jul 2018 22:00:18 +0700 Subject: [PATCH 06/11] Improved Logging Pages * Added filtering * Added random options, bound info, item special info, unique id view in item picklog --- config/access.php | 2 + config/application.php | 6 + config/cashtypes.php | 6 + config/chattypes.php | 9 ++ lib/Flux/Item.php | 6 +- modules/logdata/branch.php | 62 +++++++- modules/logdata/cashpoints.php | 91 ++++++++++- modules/logdata/char.php | 74 ++++++++- modules/logdata/chat.php | 81 +++++++++- modules/logdata/command.php | 67 +++++++- modules/logdata/mvp.php | 83 +++++++++- modules/logdata/npc.php | 49 +++++- modules/logdata/pick.php | 62 ++++++-- modules/logdata/zeny.php | 85 +++++++++- themes/default/css/flux.css | 4 +- themes/default/logdata/branch.php | 29 ++++ themes/default/logdata/cashpoints.php | 52 +++++++ themes/default/logdata/char.php | 31 ++++ themes/default/logdata/chat.php | 44 +++++- themes/default/logdata/command.php | 32 ++++ themes/default/logdata/mvp.php | 34 ++++ themes/default/logdata/npc.php | 21 +++ themes/default/logdata/pick.php | 215 +++++++++++++++++--------- themes/default/logdata/zeny.php | 37 +++++ 24 files changed, 1057 insertions(+), 125 deletions(-) create mode 100644 config/cashtypes.php create mode 100644 config/chattypes.php diff --git a/config/access.php b/config/access.php index 35606769..57126ac8 100644 --- a/config/access.php +++ b/config/access.php @@ -259,6 +259,8 @@ 'SeeAccountID' => AccountLevel::LOWGM, // Minimum group level required to see Account ID on account view and character view pages. 'SeeUnknownItems' => AccountLevel::LOWGM, // Minimum group level required to see unidentified items as identified. 'AvoidSexChangeCost' => AccountLevel::LOWGM, // Avoid paying cost (if any) for sex changes. + 'ViewCardValue' => AccountLevel::LOWGM, // Display real item random option values + 'ViewRandomOptionValue' => AccountLevel::LOWGM, // Display real item random option values 'EditHigherPower' => AccountLevel::NOONE, 'BanHigherPower' => AccountLevel::NOONE diff --git a/config/application.php b/config/application.php index 36d7c7b7..b1abf939 100644 --- a/config/application.php +++ b/config/application.php @@ -499,6 +499,12 @@ // Cash shop categories. 'CashShopCategories' => include('cashshopcategories.php'), + // Cash log types + 'CashTypes' => include('cashtypes.php'), + + // Chat log types + 'ChatTypes' => include('chattypes.php'), + // Item pick and zeny log types. 'PickTypes' => include('picktypes.php'), diff --git a/config/cashtypes.php b/config/cashtypes.php new file mode 100644 index 00000000..f8a15cb0 --- /dev/null +++ b/config/cashtypes.php @@ -0,0 +1,6 @@ + 'Cash Points', + 'K' => 'Kafra Points', + 'O' => 'Other', +); diff --git a/config/chattypes.php b/config/chattypes.php new file mode 100644 index 00000000..6af50a8c --- /dev/null +++ b/config/chattypes.php @@ -0,0 +1,9 @@ + 'Global', + 'W' => 'Whisper', + 'P' => 'Party', + 'G' => 'Guild', + 'M' => 'Main Chat', + 'C' => 'Clan', +); diff --git a/lib/Flux/Item.php b/lib/Flux/Item.php index 2c0ca1c4..e2db41a0 100644 --- a/lib/Flux/Item.php +++ b/lib/Flux/Item.php @@ -133,7 +133,7 @@ public function getCardsOver($item) { return $cardsOver; } - public function getItemSpecialValues($item) { + public function getItemSpecialValues($item, $keepCard = false) { $itemAttributes = Flux::config('Attributes')->toArray(); if ($item->card0 == $this->item_forge_flag) { $item->slots = 0; @@ -161,7 +161,8 @@ public function getItemSpecialValues($item) { $item->egg_renamed = $item->card3; } - $item->card0 = $item->card1 = $item->card2 = $item->card3 = 0; + if (!$keepCard) + $item->card0 = $item->card1 = $item->card2 = $item->card3 = 0; return $item; } @@ -201,6 +202,7 @@ public function prettyPrint($items, Flux_Template $tmp = null) { continue; $item = self::getItemSpecialValues($item); + $item->special = 1; } if ($tmp) diff --git a/modules/logdata/branch.php b/modules/logdata/branch.php index be6372e3..9e6e78ca 100644 --- a/modules/logdata/branch.php +++ b/modules/logdata/branch.php @@ -3,17 +3,69 @@ $title = Flux::message('BranchLogTitle'); +$sql_param_str = ''; +$sql_params = array(); +$datefrom = $params->get('from_date'); +$dateto = $params->get('to_date'); +$account_id = $params->get('account_id'); +$char_id = $params->get('char_id'); +$char_name = $params->get('char_name'); +$map = $params->get('map'); +if ($account_id) { + $sql_param_str .= '`account_id`=?'; + $sql_params[] = $account_id; +} +if ($char_id) { + if ($sql_param_str) + $sql_param_str .= ' AND '; + $sql_param_str .= '`char_id`=?'; + $sql_params[] = $char_id; +} +if ($char_name) { + if ($sql_param_str) + $sql_param_str .= ' AND '; + $sql_param_str .= '`char_name` LIKE ?'; + $sql_params[] = "%$char_name%"; +} +if ($map) { + if ($sql_param_str) + $sql_param_str .= ' AND '; + $sql_param_str .= '`map` LIKE ?'; + $sql_params[] = "%$map%"; +} +if ($datefrom || $dateto) { + if ($sql_param_str) + $sql_param_str .= ' AND '; + if ($datefrom && $dateto) { + $sql_param_str .= '`branch_date` BETWEEN ? AND ?'; + $sql_params[] = $datefrom; + $sql_params[] = $dateto; + } + else if ($datefrom && !$dateto) { + $sql_param_str .= '`branch_date` >= ?'; + $sql_params[] = $datefrom; + } + else { + $sql_param_str .= '`branch_date` <= ?'; + $sql_params[] = $dateto; + } +} + $sql = "SELECT COUNT(branch_id) AS total FROM {$server->logsDatabase}.branchlog"; +if ($sql_param_str) + $sql .= " WHERE ".$sql_param_str; $sth = $server->connection->getStatementForLogs($sql); -$sth->execute(); +$sth->execute($sql_params); $paginator = $this->getPaginator($sth->fetch()->total); -$paginator->setSortableColumns(array('branch_date' => 'account_id', 'char_id', 'char_name', 'map')); +$paginator->setSortableColumns(array('branch_date' => 'DESC','account_id', 'char_id', 'char_name', 'map')); -$col = 'branch_id, branch_date, account_id, char_id, char_name, map'; -$sql = $paginator->getSQL("SELECT $col FROM {$server->logsDatabase}.branchlog"); +$sql = "SELECT branch_id, branch_date, account_id, char_id, char_name, map FROM {$server->logsDatabase}.branchlog"; +if ($sql_param_str) + $sql .= " WHERE ".$sql_param_str; +$sql = $paginator->getSQL($sql); $sth = $server->connection->getStatementForLogs($sql); -$sth->execute(); +$sth->execute($sql_params); $branchs = $sth->fetchAll(); ?> diff --git a/modules/logdata/cashpoints.php b/modules/logdata/cashpoints.php index eff2770a..e4410179 100644 --- a/modules/logdata/cashpoints.php +++ b/modules/logdata/cashpoints.php @@ -3,23 +3,103 @@ $title = Flux::message('CashLogTitle'); +$sql_param_str = ''; +$sql_params = array(); +$type = array(); +if ($params->get('type')) { + $type = $params->get('type')->toArray(); + $type = array_keys($type); +} +$cash_type = array(); +if ($params->get('cash_type')) { + $cash_type = $params->get('cash_type')->toArray(); + $cash_type = array_keys($cash_type); +} +$char_id = $params->get('char_id'); +$cash_min = $params->get('cash_min'); +$cash_max = $params->get('cash_max'); +$map = $params->get('map'); +$datefrom = $params->get('from_date'); +$dateto = $params->get('to_date'); +if ($char_id) { + $sql_param_str .= '`char_id`=?'; + $sql_params[] = $char_id; +} +if ($map) { + if ($sql_param_str) + $sql_param_str .= ' AND '; + $sql_param_str .= '`map` LIKE ?'; + $sql_params[] = "%$map%"; +} +if (count($type)) { + if ($sql_param_str) + $sql_param_str .= ' AND '; + $sql_param_str .= '`type` IN ('.implode(',', array_fill(0, count($type), '?')).')'; + $sql_params = array_merge($sql_params, $type); +} +if (count($cash_type)) { + if ($sql_param_str) + $sql_param_str .= ' AND '; + $sql_param_str .= '`cash_type` IN ('.implode(',', array_fill(0, count($cash_type), '?')).')'; + $sql_params = array_merge($sql_params, $cash_type); +} +if ($cash_min || $cash_max) { + if ($sql_param_str) + $sql_param_str .= ' AND '; + if ($cash_min && $cash_max) { + $sql_param_str .= '`amount` BETWEEN ? AND ?'; + $sql_params[] = $cash_min; + $sql_params[] = $cash_max; + } + else if ($cash_min && !$cash_max) { + $sql_param_str .= '`amount` >= ?'; + $sql_params[] = $cash_min; + } + else { + $sql_param_str .= '`amount` <= ?'; + $sql_params[] = $cash_max; + } +} +if ($datefrom || $dateto) { + if ($sql_param_str) + $sql_param_str .= ' AND '; + if ($datefrom && $dateto) { + $sql_param_str .= '`time` BETWEEN ? AND ?'; + $sql_params[] = $datefrom; + $sql_params[] = $dateto; + } + else if ($datefrom && !$dateto) { + $sql_param_str .= '`time` >= ?'; + $sql_params[] = $datefrom; + } + else { + $sql_param_str .= '`time` <= ?'; + $sql_params[] = $dateto; + } +} + $sql = "SELECT COUNT(id) AS total FROM {$server->logsDatabase}.cashlog"; +if ($sql_param_str) + $sql .= " WHERE ".$sql_param_str; $sth = $server->connection->getStatementForLogs($sql); -$sth->execute(); +$sth->execute($sql_params); $paginator = $this->getPaginator($sth->fetch()->total); -$paginator->setSortableColumns(array('time' => 'desc', 'char_id', 'type', 'amount', 'map')); +$paginator->setSortableColumns(array('time' => 'DESC', 'char_id', 'type', 'cash_type', 'amount', 'map')); -$col = "time, char_id, type, amount, map"; -$sql = $paginator->getSQL("SELECT $col FROM {$server->logsDatabase}.cashlog"); +$sql = "SELECT `time`, `char_id`, `type`, `cash_type`, `amount`, `map` FROM {$server->logsDatabase}.cashlog"; +if ($sql_param_str) + $sql .= " WHERE ".$sql_param_str; +$sql = $paginator->getSQL($sql); $sth = $server->connection->getStatementForLogs($sql); -$sth->execute(); +$sth->execute($sql_params); $logs = $sth->fetchAll(); if ($logs) { $charIDs = array(); $pickTypes = Flux::config('PickTypes'); + $cashTypes = Flux::config('CashTypes'); foreach ($logs as $log) { $charIDs[$log->char_id] = null; @@ -32,6 +112,7 @@ } $log->pick_type = $pickTypes->get($log->type); + $log->cash_type_name = $cashTypes->get($log->cash_type); } if ($charIDs || $srcIDs) { diff --git a/modules/logdata/char.php b/modules/logdata/char.php index 1b963221..59ef814b 100644 --- a/modules/logdata/char.php +++ b/modules/logdata/char.php @@ -3,17 +3,77 @@ $title = Flux::message('CharLogTitle'); +$sql_param_str = ''; +$sql_params = array(); +$char_actions = array(); +$account_id = $params->get('account_id'); +$char_name = $params->get('char_name'); +$datefrom = $params->get('from_date'); +$dateto = $params->get('to_date'); +$other_action = $params->get('other_action'); +if ($params->get('char_action')) { + $char_actions = $params->get('char_action')->toArray(); + $char_actions = array_keys($char_actions); +} +if ($account_id) { + $sql_param_str .= '`account_id`=?'; + $sql_params[] = $account_id; +} +if ($char_name) { + if ($sql_param_str) + $sql_param_str .= ' AND '; + $sql_param_str .= '`name` LIKE ?'; + $sql_params[] = "%$char_name%"; +} +if ($other_action) { + if ($sql_param_str) + $sql_param_str .= ' AND '; + $sql_param_str .= '`char_msg` LIKE ?'; + $sql_params[] = "%$other_action%"; +} +if (count($char_actions)) { + if ($sql_param_str) + $sql_param_str .= ' AND '; + $sql_param_str .= '`char_msg` IN('.implode(',', array_fill(0, count($char_actions), '?')).')'; + $arr = array(); + if (in_array(1,$char_actions)) $arr[] = 'char select'; + if (in_array(2,$char_actions)) $arr[] = 'change char name'; + if (in_array(3,$char_actions)) $arr[] = 'make new char'; + $sql_params = array_merge($sql_params, $arr); +} +if ($datefrom || $dateto) { + if ($sql_param_str) + $sql_param_str .= ' AND '; + if ($datefrom && $dateto) { + $sql_param_str .= '`time` BETWEEN ? AND ?'; + $sql_params[] = $datefrom; + $sql_params[] = $dateto; + } + else if ($datefrom && !$dateto) { + $sql_param_str .= '`time` >= ?'; + $sql_params[] = $datefrom; + } + else { + $sql_param_str .= '`time` <= ?'; + $sql_params[] = $dateto; + } +} + $sql = "SELECT COUNT(time) AS total FROM {$server->charMapDatabase}.charlog"; -$sth = $server->connection->getStatement($sql); -$sth->execute(); +if ($sql_param_str) + $sql .= " WHERE ".$sql_param_str; +$sth = $server->connection->getStatementForLogs($sql); +$sth->execute($sql_params); $paginator = $this->getPaginator($sth->fetch()->total); -$paginator->setSortableColumns(array('time' => 'char_msg', 'account_id', 'char_num', 'name')); +$paginator->setSortableColumns(array('time' => 'DESC', 'char_msg', 'account_id', 'char_num', 'name')); -$col = 'time, char_msg, account_id, char_num, name'; -$sql = $paginator->getSQL("SELECT $col FROM {$server->charMapDatabase}.charlog ORDER BY `time` DESC"); -$sth = $server->connection->getStatement($sql); -$sth->execute(); +$sql = "SELECT time, char_msg, account_id, char_num, name FROM {$server->charMapDatabase}.charlog"; +if ($sql_param_str) + $sql .= " WHERE ".$sql_param_str; +$sql = $paginator->getSQL($sql); +$sth = $server->connection->getStatementForLogs($sql); +$sth->execute($sql_params); $chars1 = $sth->fetchAll(); ?> diff --git a/modules/logdata/chat.php b/modules/logdata/chat.php index d0b9329c..002bb73f 100644 --- a/modules/logdata/chat.php +++ b/modules/logdata/chat.php @@ -3,9 +3,70 @@ $title = 'List Chat Messages'; +$sql_param_str = ''; +$sql_params = array(); +$chat_type = array(); +if ($params->get('chat_type')) { + $chat_type = $params->get('chat_type')->toArray(); + $chat_type = array_keys($chat_type); +} +$char_id = $params->get('char_id'); +$account_id = $params->get('account_id'); +$dst_name = $params->get('dst_name'); +$map = $params->get('map'); +$datefrom = $params->get('from_date'); +$dateto = $params->get('to_date'); +if ($char_id) { + $sql_param_str .= '`src_charid`=?'; + $sql_params[] = $char_id; +} +if ($account_id) { + if ($sql_param_str) + $sql_param_str .= ' AND '; + $sql_param_str .= '`src_accountid`=?'; + $sql_params[] = $account_id; +} +if ($map) { + if ($sql_param_str) + $sql_param_str .= ' AND '; + $sql_param_str .= '`src_map` LIKE ?'; + $sql_params[] = "%$map%"; +} +if ($dst_name) { + if ($sql_param_str) + $sql_param_str .= ' AND '; + $sql_param_str .= '`dst_charname` LIKE ?'; + $sql_params[] = "%$dst_name%"; +} +if (count($chat_type)) { + if ($sql_param_str) + $sql_param_str .= ' AND '; + $sql_param_str .= '`type` IN ('.implode(',', array_fill(0, count($chat_type), '?')).')'; + $sql_params = array_merge($sql_params, $chat_type); +} +if ($datefrom || $dateto) { + if ($sql_param_str) + $sql_param_str .= ' AND '; + if ($datefrom && $dateto) { + $sql_param_str .= '`time` BETWEEN ? AND ?'; + $sql_params[] = $datefrom; + $sql_params[] = $dateto; + } + else if ($datefrom && !$dateto) { + $sql_param_str .= '`time` >= ?'; + $sql_params[] = $datefrom; + } + else { + $sql_param_str .= '`time` <= ?'; + $sql_params[] = $dateto; + } +} + $sql = "SELECT COUNT(id) AS total FROM {$server->logsDatabase}.chatlog"; +if ($sql_param_str) + $sql .= " WHERE ".$sql_param_str; $sth = $server->connection->getStatementForLogs($sql); -$sth->execute(); +$sth->execute($sql_params); $paginator = $this->getPaginator($sth->fetch()->total); $paginator->setSortableColumns(array( @@ -13,11 +74,21 @@ 'src_map', 'src_map_x', 'src_map_y', 'dst_charname', 'message' )); -$col = 'time, type, type_id, src_charid, src_accountid, src_map, src_map_x, src_map_y, dst_charname, '; -$col .= "REPLACE(message, '|00', '') AS message"; -$sql = $paginator->getSQL("SELECT $col FROM {$server->logsDatabase}.chatlog"); +$sql = "SELECT time, type, type_id, src_charid, src_accountid, src_map, src_map_x, src_map_y, dst_charname, "; +$sql .= "REPLACE(message, '|00', '') AS message FROM {$server->logsDatabase}.chatlog"; +if ($sql_param_str) + $sql .= " WHERE ".$sql_param_str; +$sql = $paginator->getSQL($sql); $sth = $server->connection->getStatementForLogs($sql); -$sth->execute(); +$sth->execute($sql_params); $messages = $sth->fetchAll(); + +$chattypes = Flux::config('ChatTypes'); + +if ($chattypes) { + foreach ($messages as $msg) { + $msg->type_str = $chattypes->get($msg->type); + } +} ?> diff --git a/modules/logdata/command.php b/modules/logdata/command.php index 0e1e1dfc..9d8e5607 100644 --- a/modules/logdata/command.php +++ b/modules/logdata/command.php @@ -3,17 +3,76 @@ $title = Flux::message('CommandLogTitle'); +$sql_param_str = ''; +$sql_params = array(); +$cmd = $params->get('cmd'); +$char_id = $params->get('char_id'); +$account_id = $params->get('account_id'); +$char_name = $params->get('char_name'); +$map = $params->get('map'); +$datefrom = $params->get('from_date'); +$dateto = $params->get('to_date'); +if ($char_id) { + $sql_param_str .= '`char_id`=?'; + $sql_params[] = $char_id; +} +if ($account_id) { + if ($sql_param_str) + $sql_param_str .= ' AND '; + $sql_param_str .= '`account_id`=?'; + $sql_params[] = $account_id; +} +if ($map) { + if ($sql_param_str) + $sql_param_str .= ' AND '; + $sql_param_str .= '`map` LIKE ?'; + $sql_params[] = "%$map%"; +} +if ($cmd) { + if ($sql_param_str) + $sql_param_str .= ' AND '; + $sql_param_str .= '`command` LIKE ?'; + $sql_params[] = "%$cmd%"; +} +if ($char_name) { + if ($sql_param_str) + $sql_param_str .= ' AND '; + $sql_param_str .= '`char_name` LIKE ?'; + $sql_params[] = "%$char_name%"; +} +if ($datefrom || $dateto) { + if ($sql_param_str) + $sql_param_str .= ' AND '; + if ($datefrom && $dateto) { + $sql_param_str .= '`time` BETWEEN ? AND ?'; + $sql_params[] = $datefrom; + $sql_params[] = $dateto; + } + else if ($datefrom && !$dateto) { + $sql_param_str .= '`time` >= ?'; + $sql_params[] = $datefrom; + } + else { + $sql_param_str .= '`time` <= ?'; + $sql_params[] = $dateto; + } +} + $sql = "SELECT COUNT(atcommand_id) AS total FROM {$server->logsDatabase}.atcommandlog"; +if ($sql_param_str) + $sql .= " WHERE ".$sql_param_str; $sth = $server->connection->getStatementForLogs($sql); -$sth->execute(); +$sth->execute($sql_params); $paginator = $this->getPaginator($sth->fetch()->total); $paginator->setSortableColumns(array('atcommand_date' => 'desc', 'account_id', 'char_id', 'char_name', 'map', 'command')); -$col = 'atcommand_id, atcommand_date, account_id, char_id, char_name, map, command'; -$sql = $paginator->getSQL("SELECT $col FROM {$server->logsDatabase}.atcommandlog"); +$sql = "SELECT atcommand_id, atcommand_date, account_id, char_id, char_name, map, command FROM {$server->logsDatabase}.atcommandlog"; +if ($sql_param_str) + $sql .= " WHERE ".$sql_param_str; +$sql = $paginator->getSQL($sql); $sth = $server->connection->getStatementForLogs($sql); -$sth->execute(); +$sth->execute($sql_params); $commands = $sth->fetchAll(); ?> diff --git a/modules/logdata/mvp.php b/modules/logdata/mvp.php index e509bc07..1b8ea363 100644 --- a/modules/logdata/mvp.php +++ b/modules/logdata/mvp.php @@ -3,17 +3,90 @@ $title = Flux::message('MVPLogTitle'); +$sql_param_str = ''; +$sql_params = array(); + +$char_id = $params->get('char_id'); +$mobid = $params->get('mobid'); +$item = $params->get('item'); +$exp_min = $params->get('exp_min'); +$exp_max = $params->get('exp_max'); +$map = $params->get('map'); +$datefrom = $params->get('from_date'); +$dateto = $params->get('to_date'); + +if ($char_id) { + $sql_param_str .= '`kill_char_id`=?'; + $sql_params[] = $char_id; +} +if ($mobid) { + if ($sql_param_str) + $sql_param_str .= ' AND '; + $sql_param_str .= '`monster_id`=?'; + $sql_params[] = $mobid; +} +if ($item) { + if ($sql_param_str) + $sql_param_str .= ' AND '; + $sql_param_str .= '`prize`=?'; + $sql_params[] = $item; +} +if ($map) { + if ($sql_param_str) + $sql_param_str .= ' AND '; + $sql_param_str .= '`map` LIKE ?'; + $sql_params[] = "%$map%"; +} +if ($exp_min || $exp_max) { + if ($sql_param_str) + $sql_param_str .= ' AND '; + if ($exp_min && $exp_max) { + $sql_param_str .= '`mvpexp` BETWEEN ? AND ?'; + $sql_params[] = $exp_min; + $sql_params[] = $exp_max; + } + else if ($exp_min && !$exp_max) { + $sql_param_str .= '`mvpexp` >= ?'; + $sql_params[] = $datefrom; + } + else { + $sql_param_str .= '`mvpexp` <= ?'; + $sql_params[] = $exp_max; + } +} +if ($datefrom || $dateto) { + if ($sql_param_str) + $sql_param_str .= ' AND '; + if ($datefrom && $dateto) { + $sql_param_str .= '`mvp_date` BETWEEN ? AND ?'; + $sql_params[] = $datefrom; + $sql_params[] = $dateto; + } + else if ($datefrom && !$dateto) { + $sql_param_str .= '`mvp_date` >= ?'; + $sql_params[] = $datefrom; + } + else { + $sql_param_str .= '`mvp_date` <= ?'; + $sql_params[] = $dateto; + } +} + $sql = "SELECT COUNT(mvp_id) AS total FROM {$server->logsDatabase}.mvplog"; +if ($sql_param_str) + $sql .= " WHERE ".$sql_param_str; $sth = $server->connection->getStatementForLogs($sql); -$sth->execute(); +$sth->execute($sql_params); $paginator = $this->getPaginator($sth->fetch()->total); -$paginator->setSortableColumns(array('mvp_date' => 'kill_char_id', 'monster_id', 'prize', 'mvpexp', 'map')); +$paginator->setSortableColumns(array('mvp_date' => 'DESC', 'kill_char_id', 'monster_id', 'prize', 'mvpexp', 'map')); -$col = 'mvp_id, mvp_date, kill_char_id, monster_id, prize, mvpexp, map'; -$sql = $paginator->getSQL("SELECT $col FROM {$server->logsDatabase}.mvplog"); +$sql = "SELECT mvp_id, mvp_date, kill_char_id, monster_id, prize, mvpexp, map FROM {$server->logsDatabase}.mvplog"; +if ($sql_param_str) + $sql .= " WHERE ".$sql_param_str; +$sql = $paginator->getSQL($sql); $sth = $server->connection->getStatementForLogs($sql); -$sth->execute(); +$sth->execute($sql_params); $mvps = $sth->fetchAll(); ?> diff --git a/modules/logdata/npc.php b/modules/logdata/npc.php index 5c568bbf..b99ebbd4 100644 --- a/modules/logdata/npc.php +++ b/modules/logdata/npc.php @@ -3,17 +3,56 @@ $title = Flux::message('NPCLogTitle'); +$sql_param_str = ''; +$sql_params = array(); + +$map = $params->get('map'); +$mes = $params->get('mes'); +$datefrom = $params->get('from_date'); +$dateto = $params->get('to_date'); +if ($map) { + $sql_param_str .= '`map` LIKE ?'; + $sql_params[] = "%$map%"; +} +if ($mes) { + if ($sql_param_str) + $sql_param_str .= ' AND '; + $sql_param_str .= '`mes` LIKE ?'; + $sql_params[] = "%$mes%"; +} +if ($datefrom || $dateto) { + if ($sql_param_str) + $sql_param_str .= ' AND '; + if ($datefrom && $dateto) { + $sql_param_str .= '`npc_date` BETWEEN ? AND ?'; + $sql_params[] = $datefrom; + $sql_params[] = $dateto; + } + else if ($datefrom && !$dateto) { + $sql_param_str .= '`npc_date` >= ?'; + $sql_params[] = $datefrom; + } + else { + $sql_param_str .= '`npc_date` <= ?'; + $sql_params[] = $dateto; + } +} + $sql = "SELECT COUNT(npc_id) AS total FROM {$server->logsDatabase}.npclog"; +if ($sql_param_str) + $sql .= " WHERE ".$sql_param_str; $sth = $server->connection->getStatementForLogs($sql); -$sth->execute(); +$sth->execute($sql_params); $paginator = $this->getPaginator($sth->fetch()->total); -$paginator->setSortableColumns(array('npc_id' => 'npc_date', 'account_id', 'char_id', 'char_name', 'map', 'mes')); +$paginator->setSortableColumns(array('npc_date' => 'DESC', 'npc_id', 'account_id', 'char_id', 'char_name', 'map', 'mes')); -$col = 'npc_id, npc_date, account_id, char_id, char_name, map, mes'; -$sql = $paginator->getSQL("SELECT $col FROM {$server->logsDatabase}.npclog"); +$sql = "SELECT npc_id, npc_date, account_id, char_id, char_name, map, mes FROM {$server->logsDatabase}.npclog"; +if ($sql_param_str) + $sql .= " WHERE ".$sql_param_str; +$sql = $paginator->getSQL($sql); $sth = $server->connection->getStatementForLogs($sql); -$sth->execute(); +$sth->execute($sql_params); $npcs = $sth->fetchAll(); ?> diff --git a/modules/logdata/pick.php b/modules/logdata/pick.php index b0c2dec1..9e904f33 100644 --- a/modules/logdata/pick.php +++ b/modules/logdata/pick.php @@ -10,30 +10,48 @@ $sql_params = array(); $char_id = $params->get('char_id'); +$unique_id = $params->get('unique_id'); $nameid = $params->get('nameid'); $map = $params->get('map'); $card = $params->get('card'); -$datefrom = $params->get('datefrom'); -$dateto = $params->get('dateto'); +$datefrom = $params->get('from_date'); +$dateto = $params->get('to_date'); +$hasrandomopt = $params->get('option'); +$type = array(); +if ($params->get('type')) { + $type = $params->get('type')->toArray(); + $type = array_keys($type); +} +$bound = array(); +if ($params->get('bound')) { + $bound = $params->get('bound')->toArray(); + $bound = array_keys($bound); +} if ($char_id) { - $sql_param_str = '`char_id`=?'; + $sql_param_str .= '`char_id`=?'; $sql_params[] = $char_id; } if ($nameid) { - if (count($sql_params)) + if ($sql_param_str) $sql_param_str .= ' AND '; $sql_param_str .= '`nameid`=?'; $sql_params[] = $nameid; } if ($map) { - if (count($sql_params)) + if ($sql_param_str) $sql_param_str .= ' AND '; $sql_param_str .= '`map` LIKE ?'; $sql_params[] = "%$map%"; } +if ($unique_id) { + if ($sql_param_str) + $sql_param_str .= ' AND '; + $sql_param_str .= '`unique_id`=?'; + $sql_params[] = "$unique_id"; +} if ($card) { - if (count($sql_params)) + if ($sql_param_str) $sql_param_str .= ' AND '; $sql_param_str .= '(`card0`=? OR `card1`=? OR `card2`=? OR `card3`=?)'; $sql_params[] = $card; @@ -41,8 +59,25 @@ $sql_params[] = $card; $sql_params[] = $card; } +if ($hasrandomopt) { + if ($sql_param_str) + $sql_param_str .= ' AND '; + $sql_param_str .= '((`option_id0` + `option_id1` + `option_id2` + `option_id3` + `option_id4`) > 0 )'; +} +if (count($type)) { + if ($sql_param_str) + $sql_param_str .= ' AND '; + $sql_param_str .= '`type` IN ('.implode(',', array_fill(0, count($type), '?')).')'; + $sql_params = array_merge($sql_params, $type); +} +if (count($bound)) { + if ($sql_param_str) + $sql_param_str .= ' AND '; + $sql_param_str .= '`bound` IN ('.implode(',', array_fill(0, count($bound), '?')).')'; + $sql_params = array_merge($sql_params, $bound); +} if ($datefrom || $dateto) { - if (count($sql_params)) + if ($sql_param_str) $sql_param_str .= ' AND '; if ($datefrom && $dateto) { $sql_param_str .= '`time` BETWEEN ? AND ?'; @@ -50,17 +85,17 @@ $sql_params[] = $dateto; } else if ($datefrom && !$dateto) { - $sql_param_str .= '`time` > ?'; + $sql_param_str .= '`time` >= ?'; $sql_params[] = $datefrom; } else { - $sql_param_str .= '`time` < ?'; + $sql_param_str .= '`time` <= ?'; $sql_params[] = $dateto; } } $sql = "SELECT COUNT(`id`) AS total FROM {$server->logsDatabase}.picklog"; -if (count($sql_params)) +if ($sql_param_str) $sql .= " WHERE ".$sql_param_str; $sth = $server->connection->getStatementForLogs($sql); $sth->execute($sql_params); @@ -74,7 +109,7 @@ $sql = "SELECT `time`, `char_id`, `type`, `nameid`, `amount`, `refine`, `card0`, `card1`, `card2`, `card3`,`map`"; $sql .= ",`bound`,`unique_id` ".$itemLib->random_options_select; $sql .= "FROM {$server->logsDatabase}.picklog"; -if (count($sql_params)) +if ($sql_param_str) $sql .= " WHERE ".$sql_param_str; $sql = $paginator->getSQL($sql); $sth = $server->connection->getStatementForLogs($sql); @@ -82,6 +117,9 @@ $picks = $sth->fetchAll(); +$viewCardValue = $auth->AllowedToViewCardValue; +$viewRandomOpt = $auth->AllowedToViewRandomOptionValue; + if ($picks) { $charIDs = array(); $itemIDs = array(); @@ -122,7 +160,7 @@ $pick->cardsOver = 0; $pick->creator_char_id = (($pick->card3<<16)|$pick->card2); $creatorIDs[$pick->creator_char_id] = null; - $pick = $itemLib->getItemSpecialValues($pick); + $pick = $itemLib->getItemSpecialValues($pick, $viewCardValue); $pick->special = 1; } diff --git a/modules/logdata/zeny.php b/modules/logdata/zeny.php index cca8f19a..e89b5e82 100644 --- a/modules/logdata/zeny.php +++ b/modules/logdata/zeny.php @@ -3,17 +3,94 @@ $title = Flux::message('ZenyLogTitle'); +$sql_param_str = ''; +$sql_params = array(); + +$charfrom = $params->get('from_char'); +$charto = $params->get('to_char'); +$datefrom = $params->get('from_date'); +$dateto = $params->get('to_date'); +$zeny_min = $params->get('zeny_min'); +$zeny_max = $params->get('zeny_max'); +$map = $params->get('map'); +$type = array(); +if ($params->get('type')) { + $type = $params->get('type')->toArray(); + $type = array_keys($type); +} + +if ($charfrom) { + $sql_param_str .= '`src_id`=?'; + $sql_params[] = $charfrom; +} +if ($charto) { + if ($sql_param_str) + $sql_param_str .= " AND "; + $sql_param_str .= '`char_id`=?'; + $sql_params[] = $charto; +} +if ($map) { + if ($sql_param_str) + $sql_param_str .= ' AND '; + $sql_param_str .= '`map` LIKE ?'; + $sql_params[] = "%$map%"; +} +if (count($type)) { + if ($sql_param_str) + $sql_param_str .= ' AND '; + $sql_param_str .= '`type` IN ('.implode(',', array_fill(0, count($type), '?')).')'; + $sql_params = array_merge($sql_params, $type); +} +if ($datefrom || $dateto) { + if ($sql_param_str) + $sql_param_str .= ' AND '; + if ($datefrom && $dateto) { + $sql_param_str .= '`time` BETWEEN ? AND ?'; + $sql_params[] = $datefrom; + $sql_params[] = $dateto; + } + else if ($datefrom && !$dateto) { + $sql_param_str .= '`time` >= ?'; + $sql_params[] = $datefrom; + } + else { + $sql_param_str .= '`time` <= ?'; + $sql_params[] = $dateto; + } +} +if ($zeny_min || $zeny_max) { + if ($sql_param_str) + $sql_param_str .= ' AND '; + if ($zeny_min && $zeny_max) { + $sql_param_str .= '`amount` BETWEEN ? AND ?'; + $sql_params[] = $zeny_min; + $sql_params[] = $zeny_max; + } + else if ($zeny_min && !$zeny_max) { + $sql_param_str .= '`amount` >= ?'; + $sql_params[] = $zeny_min; + } + else { + $sql_param_str .= '`amount` <= ?'; + $sql_params[] = $zeny_max; + } +} + $sql = "SELECT COUNT(id) AS total FROM {$server->logsDatabase}.zenylog"; +if ($sql_param_str) + $sql .= " WHERE ".$sql_param_str; $sth = $server->connection->getStatementForLogs($sql); -$sth->execute(); +$sth->execute($sql_params); $paginator = $this->getPaginator($sth->fetch()->total); $paginator->setSortableColumns(array('time' => 'desc', 'char_id', 'src_id', 'type', 'amount', 'map')); -$col = "time, char_id, src_id, type, amount, map"; -$sql = $paginator->getSQL("SELECT $col FROM {$server->logsDatabase}.zenylog"); +$sql = "SELECT time, char_id, src_id, type, amount, map FROM {$server->logsDatabase}.zenylog"; +if ($sql_param_str) + $sql .= " WHERE ".$sql_param_str; +$sql = $paginator->getSQL($sql); $sth = $server->connection->getStatementForLogs($sql); -$sth->execute(); +$sth->execute($sql_params); $logs = $sth->fetchAll(); diff --git a/themes/default/css/flux.css b/themes/default/css/flux.css index bd1d2dd0..96782245 100644 --- a/themes/default/css/flux.css +++ b/themes/default/css/flux.css @@ -1152,7 +1152,7 @@ textarea { cursor:pointer!important; } -ul.item-options { +ul.item-options, ol.item-options, ul.item-options-real, ol.item-options-real { padding:0 0 0 1.3em; } @@ -1160,3 +1160,5 @@ ul.item-options { text-decoration:underline; } +.picklog-extra-row td { +} diff --git a/themes/default/logdata/branch.php b/themes/default/logdata/branch.php index 1ba4848d..9220888d 100644 --- a/themes/default/logdata/branch.php +++ b/themes/default/logdata/branch.php @@ -1,5 +1,34 @@

+ +

Search...

+
+ moduleActionFormInputs($params->get('module')) ?> +

+ + + ... + + + ... + + + ... + + + ... +
+ + + ... + + + ... + + +

+
+ infoText() ?> diff --git a/themes/default/logdata/cashpoints.php b/themes/default/logdata/cashpoints.php index 7ee7003f..2b1b6b59 100644 --- a/themes/default/logdata/cashpoints.php +++ b/themes/default/logdata/cashpoints.php @@ -1,11 +1,54 @@

+ +

Search...

+ + moduleActionFormInputs($params->get('module')) ?> +

+ + + ... + + + ... + + + ... + + + ... +
+
+ + toArray() as $cashtype => $cashname): ?> + + +
+
+ + toArray() as $picktype => $pickname): ?> + + +
+
+ + + ... + + + ... + + +

+ + infoText() ?>
+ @@ -30,6 +73,15 @@ +
sortableColumn('time', Flux::message('CashLogDateLabel')) ?> sortableColumn('char_id', Flux::message('CashLogCharacterLabel')) ?>sortableColumn('cash_type', Flux::message('CashLogCashTypeLabel')) ?> sortableColumn('type', Flux::message('CashLogTypeLabel')) ?> sortableColumn('amount', Flux::message('CashLogAmountLabel')) ?> sortableColumn('map', Flux::message('CashLogMapLabel')) ?> + cash_type_name): ?> + cash_type_name) ?> + cash_type): ?> + cash_type ?> + + + + pick_type): ?> pick_type) ?> diff --git a/themes/default/logdata/char.php b/themes/default/logdata/char.php index 414ad452..77496886 100644 --- a/themes/default/logdata/char.php +++ b/themes/default/logdata/char.php @@ -1,5 +1,36 @@

+

Search...

+
+ moduleActionFormInputs($params->get('module')) ?> +

+ + + ... + + + ... +
+
+ + + + + + + ... +
+
+ + + ... + + + ... + + +

+
infoText() ?> diff --git a/themes/default/logdata/chat.php b/themes/default/logdata/chat.php index d9e61617..440454df 100644 --- a/themes/default/logdata/chat.php +++ b/themes/default/logdata/chat.php @@ -1,5 +1,41 @@

Chat Messages

+ +

Search...

+ + moduleActionFormInputs($params->get('module')) ?> +

+ + + ... + + + ... + + + ... + + + ... +
+
+ + toArray() as $chattype => $chatname): ?> + + +
+
+ + + ... + + + ... + + +

+ + infoText() ?>
@@ -18,7 +54,13 @@ - +
formatDateTime($message->time) ?>type ?> + type_str): ?> + type_str ?> + + type ?> + + type_id): ?> type == 'G' && $auth->actionAllowed('guild', 'view') && $auth->allowedToViewGuild): ?> diff --git a/themes/default/logdata/command.php b/themes/default/logdata/command.php index 431a91e5..7cb721eb 100644 --- a/themes/default/logdata/command.php +++ b/themes/default/logdata/command.php @@ -1,5 +1,37 @@

+ +

Search...

+
+ moduleActionFormInputs($params->get('module')) ?> +

+ + + ... + + + ... + + + ... + + + ... + + + ... +
+ + + ... + + + ... + + +

+
+ infoText() ?> diff --git a/themes/default/logdata/mvp.php b/themes/default/logdata/mvp.php index f1a99965..d7558b0f 100644 --- a/themes/default/logdata/mvp.php +++ b/themes/default/logdata/mvp.php @@ -1,5 +1,39 @@

+ +

Search...

+ + moduleActionFormInputs($params->get('module')) ?> +

+ + + ... + + + ... + + + ... + + + ... + + + ... + + + ... +
+ + + ... + + + ... + + +

+infoText() ?>
diff --git a/themes/default/logdata/npc.php b/themes/default/logdata/npc.php index 70e36904..c66e5211 100644 --- a/themes/default/logdata/npc.php +++ b/themes/default/logdata/npc.php @@ -1,5 +1,26 @@

+

Search...

+ + moduleActionFormInputs($params->get('module')) ?> +

+ + + ... + + + ... +
+ + + ... + + + ... + + +

+infoText() ?>
diff --git a/themes/default/logdata/pick.php b/themes/default/logdata/pick.php index 681e23ea..31b2f94d 100644 --- a/themes/default/logdata/pick.php +++ b/themes/default/logdata/pick.php @@ -11,17 +11,36 @@ ... + + + ... ... - - + + + ...
- - +
+ + toArray() as $picktype => $pickname): ?> + + +
+
+ + + + + + + get('option')) echo "checked=\"yes\"" ?> /> ... - - + + + ... + + ... @@ -43,9 +62,10 @@ + $pick): ?> - + bound)) echo "class=\"bound-item\""; ?>> - - special): ?> - - - - + - options): ?> - - + extra): ?> + "> + + + + + + diff --git a/themes/default/logdata/zeny.php b/themes/default/logdata/zeny.php index a3c8f385..011f688d 100644 --- a/themes/default/logdata/zeny.php +++ b/themes/default/logdata/zeny.php @@ -1,5 +1,42 @@

+

Search...

+ + moduleActionFormInputs($params->get('module')) ?> +

+ + + ... + + + ... + + + ... + + + ... + + + ... +
+
+ + toArray() as $picktype => $pickname): ?> + + +
+
+ + + ... + + + ... + + +

+infoText() ?>
sortableColumn('card2', Flux::message('PickLogCard2Label')) ?> sortableColumn('card3', Flux::message('PickLogCard3Label')) ?> sortableColumn('map', Flux::message('PickLogMapLabel')) ?>Extra
formatDateTime($pick->time) ?> char_name): ?> @@ -90,6 +110,28 @@ + is_forged || $pick->is_creation): ?> + forged_prefix): ?> + forged_prefix) ?> + + creator_char_id, $creatorIDs) && $creatorIDs[$pick->creator_char_id]): ?> + creator_char_id] ?> + + creator_char_id."]" ?> + + actionAllowed('character', 'view') && $auth->allowedToViewCharacter): ?> + linkToCharacter($pick->char_id, $dispcharname, $session->serverName); ?> + + 's + element): ?> + element) ?> + + is_egg): ?> + egg_renamed): ?> + + + + item_name): ?> actionAllowed('item', 'view')): ?> linkToItem($pick->nameid, $pick->item_name) ?> @@ -105,121 +147,89 @@ - options): ?> - options.">" ?> - - bound): ?> - <B> - amount >= 0 ? '+'.number_format($pick->amount) : number_format($pick->amount) ?> refine ?> - card0_name): ?> + card0_name && !$pick->special): ?> actionAllowed('item', 'view')): ?> linkToItem($pick->card0, $pick->card0_name) ?> card0_name) ?> - card0): ?> + card0 && !$pick->special): ?> actionAllowed('item', 'view')): ?> linkToItem($pick->card0, $pick->card0) ?> card0) ?> + card0): ?> + card0; ?> - card1_name): ?> + card1_name && !$pick->special): ?> actionAllowed('item', 'view')): ?> linkToItem($pick->card1, $pick->card1_name) ?> card1_name) ?> - card1): ?> + card1 && !$pick->special): ?> actionAllowed('item', 'view')): ?> linkToItem($pick->card1, $pick->card1) ?> card1) ?> + card1): ?> + card1; ?> - card2_name): ?> + card2_name && !$pick->special): ?> actionAllowed('item', 'view')): ?> linkToItem($pick->card2, $pick->card2_name) ?> card2_name) ?> - card2): ?> + card2 && !$pick->special): ?> actionAllowed('item', 'view')): ?> linkToItem($pick->card2, $pick->card2) ?> card2) ?> + card2): ?> + card2; ?> - card3_name): ?> + card3_name && !$pick->special): ?> actionAllowed('item', 'view')): ?> linkToItem($pick->card3, $pick->card3_name) ?> card3_name) ?> - card3): ?> + card3 && !$pick->special): ?> actionAllowed('item', 'view')): ?> linkToItem($pick->card3, $pick->card3) ?> card3) ?> + card3): ?> + card3; ?> - is_forged || $pick->is_creation): ?> - - forged_prefix): ?> - forged_prefix) ?> - - - creator_char_id, $creatorIDs) && $creatorIDs[$pick->creator_char_id]): ?> - creator_char_id] ?> - - creator_char_id."]" ?> - - actionAllowed('character', 'view') && $auth->allowedToViewCharacter): ?> - linkToCharacter($pick->char_id, $dispcharname, $session->serverName); ?> - - 's - - element): ?> - element) ?> - - - is_egg): ?> - - egg_renamed): ?> - - - - - map): ?> map, '.gat')) ?> @@ -227,21 +237,88 @@ + options): ?> + extra = "<".$pick->options.">"; ?> + + bound): ?> + extra .= "<B>"; ?> + + unique_id): ?> + extra .= "<U>"; ?> + + + extra): ?> + extra ?> + +
From 726021cca9e6b5c93facbe1209c5e3ff93efbb6b Mon Sep 17 00:00:00 2001 From: Cydh Ramdh Date: Tue, 10 Jul 2018 16:36:43 +0700 Subject: [PATCH 07/11] Moved 'ItemSpecial' and 'BoundLabels' to files --- config/access.php | 2 +- config/application.php | 17 ++--------------- config/bound_types.php | 7 +++++++ config/item_special.php | 7 +++++++ 4 files changed, 17 insertions(+), 16 deletions(-) create mode 100644 config/bound_types.php create mode 100644 config/item_special.php diff --git a/config/access.php b/config/access.php index 57126ac8..42541439 100644 --- a/config/access.php +++ b/config/access.php @@ -259,7 +259,7 @@ 'SeeAccountID' => AccountLevel::LOWGM, // Minimum group level required to see Account ID on account view and character view pages. 'SeeUnknownItems' => AccountLevel::LOWGM, // Minimum group level required to see unidentified items as identified. 'AvoidSexChangeCost' => AccountLevel::LOWGM, // Avoid paying cost (if any) for sex changes. - 'ViewCardValue' => AccountLevel::LOWGM, // Display real item random option values + 'ViewCardValue' => AccountLevel::LOWGM, // Display real card values 'ViewRandomOptionValue' => AccountLevel::LOWGM, // Display real item random option values 'EditHigherPower' => AccountLevel::NOONE, diff --git a/config/application.php b/config/application.php index b1abf939..a032d023 100644 --- a/config/application.php +++ b/config/application.php @@ -126,23 +126,10 @@ ), 'RandomOptions' => true, // Enable random options lookup. Set this falee to disable - 'RandomOptionIDs' => include('randomoption_ids.php'), 'RandomOptionMessages' => include('randomoptions.php'), - - // Card0 special flag. In Older rAthena is 254,255,-256 - 'ItemSpecial' => array( - 'forge' => 0x00FF, - 'create' => 0x00FE, - 'pet' => 0x0100, - ), - - 'BoundLabels' => array( - 1 => 'BoundAccountLabel', - 2 => 'BoundGuildLabel', - 3 => 'BoundPartyLabel', - 4 => 'BoundCharacterLabel', - ), + 'ItemSpecial' => include('item_special.php'), + 'BoundLabels' => include('bound_types.php'), 'HoldUntrustedAccount' => 0, // This is the time in hours to hold a donation crediting process for, if the account // isn't a trusted account. Specify 0 or false to disable this feature. diff --git a/config/bound_types.php b/config/bound_types.php new file mode 100644 index 00000000..b856e259 --- /dev/null +++ b/config/bound_types.php @@ -0,0 +1,7 @@ + 'BoundAccountLabel', + 2 => 'BoundGuildLabel', + 3 => 'BoundPartyLabel', + 4 => 'BoundCharacterLabel', +); diff --git a/config/item_special.php b/config/item_special.php new file mode 100644 index 00000000..1c7d6c1f --- /dev/null +++ b/config/item_special.php @@ -0,0 +1,7 @@ + 0x00FF, + 'create' => 0x00FE, + 'pet' => 0x0100, +); From 42c960cf1b2af18dd83cf53f83ced77bd936eaf0 Mon Sep 17 00:00:00 2001 From: Cydh Ramdh Date: Tue, 10 Jul 2018 16:53:54 +0700 Subject: [PATCH 08/11] Clean up and log update * Added filter for inter logs * Cleanup date filtering in logdata --- modules/logdata/branch.php | 23 +++++++--------- modules/logdata/cashpoints.php | 46 +++++++++++++------------------- modules/logdata/char.php | 23 +++++++--------- modules/logdata/chat.php | 23 +++++++--------- modules/logdata/command.php | 23 +++++++--------- modules/logdata/feeding.php | 23 +++++++--------- modules/logdata/inter.php | 37 +++++++++++++++++++++---- modules/logdata/mvp.php | 46 +++++++++++++------------------- modules/logdata/npc.php | 23 +++++++--------- modules/logdata/pick.php | 23 +++++++--------- modules/logdata/zeny.php | 46 +++++++++++++------------------- themes/default/logdata/inter.php | 19 +++++++++++++ 12 files changed, 168 insertions(+), 187 deletions(-) diff --git a/modules/logdata/branch.php b/modules/logdata/branch.php index 9e6e78ca..313a61e3 100644 --- a/modules/logdata/branch.php +++ b/modules/logdata/branch.php @@ -33,22 +33,17 @@ $sql_param_str .= '`map` LIKE ?'; $sql_params[] = "%$map%"; } -if ($datefrom || $dateto) { +if ($datefrom) { if ($sql_param_str) $sql_param_str .= ' AND '; - if ($datefrom && $dateto) { - $sql_param_str .= '`branch_date` BETWEEN ? AND ?'; - $sql_params[] = $datefrom; - $sql_params[] = $dateto; - } - else if ($datefrom && !$dateto) { - $sql_param_str .= '`branch_date` >= ?'; - $sql_params[] = $datefrom; - } - else { - $sql_param_str .= '`branch_date` <= ?'; - $sql_params[] = $dateto; - } + $sql_param_str .= '`branch_date` >= ?'; + $sql_params[] = $datefrom; +} +if ($dateto) { + if ($sql_param_str) + $sql_param_str .= ' AND '; + $sql_param_str .= '`branch_date` <= ?'; + $sql_params[] = $dateto; } $sql = "SELECT COUNT(branch_id) AS total FROM {$server->logsDatabase}.branchlog"; diff --git a/modules/logdata/cashpoints.php b/modules/logdata/cashpoints.php index e4410179..d3e65ef8 100644 --- a/modules/logdata/cashpoints.php +++ b/modules/logdata/cashpoints.php @@ -43,39 +43,29 @@ $sql_param_str .= '`cash_type` IN ('.implode(',', array_fill(0, count($cash_type), '?')).')'; $sql_params = array_merge($sql_params, $cash_type); } -if ($cash_min || $cash_max) { +if ($cash_min) { if ($sql_param_str) $sql_param_str .= ' AND '; - if ($cash_min && $cash_max) { - $sql_param_str .= '`amount` BETWEEN ? AND ?'; - $sql_params[] = $cash_min; - $sql_params[] = $cash_max; - } - else if ($cash_min && !$cash_max) { - $sql_param_str .= '`amount` >= ?'; - $sql_params[] = $cash_min; - } - else { - $sql_param_str .= '`amount` <= ?'; - $sql_params[] = $cash_max; - } + $sql_param_str .= '`amount` >= ?'; + $sql_params[] = $cash_min; } -if ($datefrom || $dateto) { +if ($cash_max) { if ($sql_param_str) $sql_param_str .= ' AND '; - if ($datefrom && $dateto) { - $sql_param_str .= '`time` BETWEEN ? AND ?'; - $sql_params[] = $datefrom; - $sql_params[] = $dateto; - } - else if ($datefrom && !$dateto) { - $sql_param_str .= '`time` >= ?'; - $sql_params[] = $datefrom; - } - else { - $sql_param_str .= '`time` <= ?'; - $sql_params[] = $dateto; - } + $sql_param_str .= '`amount` <= ?'; + $sql_params[] = $cash_max; +} +if ($datefrom) { + if ($sql_param_str) + $sql_param_str .= ' AND '; + $sql_param_str .= '`time` >= ?'; + $sql_params[] = $datefrom; +} +if ($dateto) { + if ($sql_param_str) + $sql_param_str .= ' AND '; + $sql_param_str .= '`time` <= ?'; + $sql_params[] = $dateto; } $sql = "SELECT COUNT(id) AS total FROM {$server->logsDatabase}.cashlog"; diff --git a/modules/logdata/char.php b/modules/logdata/char.php index 59ef814b..95a7ad5a 100644 --- a/modules/logdata/char.php +++ b/modules/logdata/char.php @@ -41,22 +41,17 @@ if (in_array(3,$char_actions)) $arr[] = 'make new char'; $sql_params = array_merge($sql_params, $arr); } -if ($datefrom || $dateto) { +if ($datefrom) { if ($sql_param_str) $sql_param_str .= ' AND '; - if ($datefrom && $dateto) { - $sql_param_str .= '`time` BETWEEN ? AND ?'; - $sql_params[] = $datefrom; - $sql_params[] = $dateto; - } - else if ($datefrom && !$dateto) { - $sql_param_str .= '`time` >= ?'; - $sql_params[] = $datefrom; - } - else { - $sql_param_str .= '`time` <= ?'; - $sql_params[] = $dateto; - } + $sql_param_str .= '`time` >= ?'; + $sql_params[] = $datefrom; +} +if ($dateto) { + if ($sql_param_str) + $sql_param_str .= ' AND '; + $sql_param_str .= '`time` <= ?'; + $sql_params[] = $dateto; } $sql = "SELECT COUNT(time) AS total FROM {$server->charMapDatabase}.charlog"; diff --git a/modules/logdata/chat.php b/modules/logdata/chat.php index 002bb73f..9ab0ca42 100644 --- a/modules/logdata/chat.php +++ b/modules/logdata/chat.php @@ -44,22 +44,17 @@ $sql_param_str .= '`type` IN ('.implode(',', array_fill(0, count($chat_type), '?')).')'; $sql_params = array_merge($sql_params, $chat_type); } -if ($datefrom || $dateto) { +if ($datefrom) { if ($sql_param_str) $sql_param_str .= ' AND '; - if ($datefrom && $dateto) { - $sql_param_str .= '`time` BETWEEN ? AND ?'; - $sql_params[] = $datefrom; - $sql_params[] = $dateto; - } - else if ($datefrom && !$dateto) { - $sql_param_str .= '`time` >= ?'; - $sql_params[] = $datefrom; - } - else { - $sql_param_str .= '`time` <= ?'; - $sql_params[] = $dateto; - } + $sql_param_str .= '`time` >= ?'; + $sql_params[] = $datefrom; +} +if ($dateto) { + if ($sql_param_str) + $sql_param_str .= ' AND '; + $sql_param_str .= '`time` <= ?'; + $sql_params[] = $dateto; } $sql = "SELECT COUNT(id) AS total FROM {$server->logsDatabase}.chatlog"; diff --git a/modules/logdata/command.php b/modules/logdata/command.php index 9d8e5607..acc66fc0 100644 --- a/modules/logdata/command.php +++ b/modules/logdata/command.php @@ -40,22 +40,17 @@ $sql_param_str .= '`char_name` LIKE ?'; $sql_params[] = "%$char_name%"; } -if ($datefrom || $dateto) { +if ($datefrom) { if ($sql_param_str) $sql_param_str .= ' AND '; - if ($datefrom && $dateto) { - $sql_param_str .= '`time` BETWEEN ? AND ?'; - $sql_params[] = $datefrom; - $sql_params[] = $dateto; - } - else if ($datefrom && !$dateto) { - $sql_param_str .= '`time` >= ?'; - $sql_params[] = $datefrom; - } - else { - $sql_param_str .= '`time` <= ?'; - $sql_params[] = $dateto; - } + $sql_param_str .= '`time` >= ?'; + $sql_params[] = $datefrom; +} +if ($dateto) { + if ($sql_param_str) + $sql_param_str .= ' AND '; + $sql_param_str .= '`time` <= ?'; + $sql_params[] = $dateto; } $sql = "SELECT COUNT(atcommand_id) AS total FROM {$server->logsDatabase}.atcommandlog"; diff --git a/modules/logdata/feeding.php b/modules/logdata/feeding.php index dd3ab9df..1f9b42b6 100644 --- a/modules/logdata/feeding.php +++ b/modules/logdata/feeding.php @@ -45,22 +45,17 @@ $sql_param_str .= '`type` IN ('.implode(',', array_fill(0, count($type), '?')).')'; $sql_params = array_merge($sql_params, $type); } -if ($datefrom || $dateto) { +if ($datefrom) { if ($sql_param_str) $sql_param_str .= ' AND '; - if ($datefrom && $dateto) { - $sql_param_str .= '(DATE_FORMAT(`time`,\'%Y-%m-%d\') BETWEEN CAST(? AS DATE) AND CAST(? AS DATE))'; - $sql_params[] = $datefrom; - $sql_params[] = $dateto; - } - else if ($datefrom && !$dateto) { - $sql_param_str .= '`time` >= ?'; - $sql_params[] = $datefrom; - } - else { - $sql_param_str .= '`time` <= ?'; - $sql_params[] = $dateto; - } + $sql_param_str .= '`time` >= ?'; + $sql_params[] = $datefrom; +} +if ($dateto) { + if ($sql_param_str) + $sql_param_str .= ' AND '; + $sql_param_str .= '`time` <= ?'; + $sql_params[] = $dateto; } $sql = "SELECT COUNT(`id`) AS total FROM {$server->logsDatabase}.feedinglog"; diff --git a/modules/logdata/inter.php b/modules/logdata/inter.php index 03325443..3db230a5 100644 --- a/modules/logdata/inter.php +++ b/modules/logdata/inter.php @@ -3,17 +3,44 @@ $title = Flux::message('InterLogTitle'); -$sql = "SELECT COUNT(time) AS total FROM {$server->charMapDatabase}.interlog"; +$sql_param_str = ''; +$sql_params = array(); + +$logmsg = $params->get('logmsg'); +$datefrom = $params->get('from_date'); +$dateto = $params->get('to_date'); +if ($msg) { + $sql_param_str = '`log` LIKE ?'; + $sql_params[] = "%$logmsg%"; +} +if ($datefrom) { + if ($sql_param_str) + $sql_param_str .= ' AND '; + $sql_param_str .= '`time` >= ?'; + $sql_params[] = $datefrom; +} +if ($dateto) { + if ($sql_param_str) + $sql_param_str .= ' AND '; + $sql_param_str .= '`time` <= ?'; + $sql_params[] = $dateto; +} + +$sql = "SELECT COUNT(`time`) as total` FROM {$server->charMapDatabase}.interlog"; +if ($sql_param_str) + $sql .= " WHERE ".$sql_param_str; $sth = $server->connection->getStatement($sql); -$sth->execute(); +$sth->execute($sql_params); $paginator = $this->getPaginator($sth->fetch()->total); $paginator->setSortableColumns(array('time' => 'DESC','log')); -$col = 'time, log'; -$sql = $paginator->getSQL("SELECT $col FROM {$server->charMapDatabase}.interlog"); +$sql = "SELECT `time`, `log` FROM {$server->charMapDatabase}.interlog"; +if ($sql_param_str) + $sql .= " WHERE ".$sql_param_str; +$sql = $paginator->getSQL($sql); $sth = $server->connection->getStatement($sql); -$sth->execute(); +$sth->execute($sql_params); $inters = $sth->fetchAll(); ?> diff --git a/modules/logdata/mvp.php b/modules/logdata/mvp.php index 1b8ea363..77cb80d3 100644 --- a/modules/logdata/mvp.php +++ b/modules/logdata/mvp.php @@ -37,39 +37,29 @@ $sql_param_str .= '`map` LIKE ?'; $sql_params[] = "%$map%"; } -if ($exp_min || $exp_max) { +if ($exp_min) { if ($sql_param_str) $sql_param_str .= ' AND '; - if ($exp_min && $exp_max) { - $sql_param_str .= '`mvpexp` BETWEEN ? AND ?'; - $sql_params[] = $exp_min; - $sql_params[] = $exp_max; - } - else if ($exp_min && !$exp_max) { - $sql_param_str .= '`mvpexp` >= ?'; - $sql_params[] = $datefrom; - } - else { - $sql_param_str .= '`mvpexp` <= ?'; - $sql_params[] = $exp_max; - } + $sql_param_str .= '`mvpexp` >= ?'; + $sql_params[] = $exp_min; } -if ($datefrom || $dateto) { +if ($exp_max) { if ($sql_param_str) $sql_param_str .= ' AND '; - if ($datefrom && $dateto) { - $sql_param_str .= '`mvp_date` BETWEEN ? AND ?'; - $sql_params[] = $datefrom; - $sql_params[] = $dateto; - } - else if ($datefrom && !$dateto) { - $sql_param_str .= '`mvp_date` >= ?'; - $sql_params[] = $datefrom; - } - else { - $sql_param_str .= '`mvp_date` <= ?'; - $sql_params[] = $dateto; - } + $sql_param_str .= '`mvpexp` <= ?'; + $sql_params[] = $exp_max; +} +if ($datefrom) { + if ($sql_param_str) + $sql_param_str .= ' AND '; + $sql_param_str .= '`mvp_date` >= ?'; + $sql_params[] = $datefrom; +} +if ($dateto) { + if ($sql_param_str) + $sql_param_str .= ' AND '; + $sql_param_str .= '`mvp_date` <= ?'; + $sql_params[] = $dateto; } $sql = "SELECT COUNT(mvp_id) AS total FROM {$server->logsDatabase}.mvplog"; diff --git a/modules/logdata/npc.php b/modules/logdata/npc.php index b99ebbd4..fa9a77dc 100644 --- a/modules/logdata/npc.php +++ b/modules/logdata/npc.php @@ -20,22 +20,17 @@ $sql_param_str .= '`mes` LIKE ?'; $sql_params[] = "%$mes%"; } -if ($datefrom || $dateto) { +if ($datefrom) { if ($sql_param_str) $sql_param_str .= ' AND '; - if ($datefrom && $dateto) { - $sql_param_str .= '`npc_date` BETWEEN ? AND ?'; - $sql_params[] = $datefrom; - $sql_params[] = $dateto; - } - else if ($datefrom && !$dateto) { - $sql_param_str .= '`npc_date` >= ?'; - $sql_params[] = $datefrom; - } - else { - $sql_param_str .= '`npc_date` <= ?'; - $sql_params[] = $dateto; - } + $sql_param_str .= '`npc_date` >= ?'; + $sql_params[] = $datefrom; +} +if ($dateto) { + if ($sql_param_str) + $sql_param_str .= ' AND '; + $sql_param_str .= '`npc_date` <= ?'; + $sql_params[] = $dateto; } $sql = "SELECT COUNT(npc_id) AS total FROM {$server->logsDatabase}.npclog"; diff --git a/modules/logdata/pick.php b/modules/logdata/pick.php index 9e904f33..898f7135 100644 --- a/modules/logdata/pick.php +++ b/modules/logdata/pick.php @@ -76,22 +76,17 @@ $sql_param_str .= '`bound` IN ('.implode(',', array_fill(0, count($bound), '?')).')'; $sql_params = array_merge($sql_params, $bound); } -if ($datefrom || $dateto) { +if ($datefrom) { if ($sql_param_str) $sql_param_str .= ' AND '; - if ($datefrom && $dateto) { - $sql_param_str .= '`time` BETWEEN ? AND ?'; - $sql_params[] = $datefrom; - $sql_params[] = $dateto; - } - else if ($datefrom && !$dateto) { - $sql_param_str .= '`time` >= ?'; - $sql_params[] = $datefrom; - } - else { - $sql_param_str .= '`time` <= ?'; - $sql_params[] = $dateto; - } + $sql_param_str .= '`time` >= ?'; + $sql_params[] = $datefrom; +} +if ($dateto) { + if ($sql_param_str) + $sql_param_str .= ' AND '; + $sql_param_str .= '`time` <= ?'; + $sql_params[] = $dateto; } $sql = "SELECT COUNT(`id`) AS total FROM {$server->logsDatabase}.picklog"; diff --git a/modules/logdata/zeny.php b/modules/logdata/zeny.php index e89b5e82..45b89d0c 100644 --- a/modules/logdata/zeny.php +++ b/modules/logdata/zeny.php @@ -41,39 +41,29 @@ $sql_param_str .= '`type` IN ('.implode(',', array_fill(0, count($type), '?')).')'; $sql_params = array_merge($sql_params, $type); } -if ($datefrom || $dateto) { +if ($datefrom) { if ($sql_param_str) $sql_param_str .= ' AND '; - if ($datefrom && $dateto) { - $sql_param_str .= '`time` BETWEEN ? AND ?'; - $sql_params[] = $datefrom; - $sql_params[] = $dateto; - } - else if ($datefrom && !$dateto) { - $sql_param_str .= '`time` >= ?'; - $sql_params[] = $datefrom; - } - else { - $sql_param_str .= '`time` <= ?'; - $sql_params[] = $dateto; - } + $sql_param_str .= '`time` >= ?'; + $sql_params[] = $datefrom; } -if ($zeny_min || $zeny_max) { +if ($dateto) { if ($sql_param_str) $sql_param_str .= ' AND '; - if ($zeny_min && $zeny_max) { - $sql_param_str .= '`amount` BETWEEN ? AND ?'; - $sql_params[] = $zeny_min; - $sql_params[] = $zeny_max; - } - else if ($zeny_min && !$zeny_max) { - $sql_param_str .= '`amount` >= ?'; - $sql_params[] = $zeny_min; - } - else { - $sql_param_str .= '`amount` <= ?'; - $sql_params[] = $zeny_max; - } + $sql_param_str .= '`time` <= ?'; + $sql_params[] = $dateto; +} +if ($zeny_min) { + if ($sql_param_str) + $sql_param_str .= ' AND '; + $sql_param_str .= '`amount` >= ?'; + $sql_params[] = $zeny_min; +} +if ($zeny_max) { + if ($sql_param_str) + $sql_param_str .= ' AND '; + $sql_param_str .= '`amount` <= ?'; + $sql_params[] = $zeny_max; } $sql = "SELECT COUNT(id) AS total FROM {$server->logsDatabase}.zenylog"; diff --git a/themes/default/logdata/inter.php b/themes/default/logdata/inter.php index c1141e79..75eb14ad 100644 --- a/themes/default/logdata/inter.php +++ b/themes/default/logdata/inter.php @@ -1,5 +1,24 @@

+ +

Search...

+
+ moduleActionFormInputs($params->get('module')) ?> +

+ + + ... + + + ... + + + ... + + +

+ + infoText() ?>
From b1ccb622c9077a84727e1451ad756578e0f18ae2 Mon Sep 17 00:00:00 2001 From: Cydh Ramdh Date: Tue, 10 Jul 2018 17:00:04 +0700 Subject: [PATCH 09/11] Typo fixes follow up 42c960cf1b2af18dd83cf53f83ced77bd936eaf0 --- modules/logdata/inter.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/logdata/inter.php b/modules/logdata/inter.php index 3db230a5..fb1490f3 100644 --- a/modules/logdata/inter.php +++ b/modules/logdata/inter.php @@ -9,7 +9,7 @@ $logmsg = $params->get('logmsg'); $datefrom = $params->get('from_date'); $dateto = $params->get('to_date'); -if ($msg) { +if ($logmsg) { $sql_param_str = '`log` LIKE ?'; $sql_params[] = "%$logmsg%"; } @@ -26,7 +26,7 @@ $sql_params[] = $dateto; } -$sql = "SELECT COUNT(`time`) as total` FROM {$server->charMapDatabase}.interlog"; +$sql = "SELECT COUNT(`time`) as total FROM {$server->charMapDatabase}.interlog"; if ($sql_param_str) $sql .= " WHERE ".$sql_param_str; $sth = $server->connection->getStatement($sql); From 70bf9bfb370e5c21c3a2f10420684b481b80dc54 Mon Sep 17 00:00:00 2001 From: Cydh Ramdh Date: Tue, 10 Jul 2018 20:11:18 +0700 Subject: [PATCH 10/11] Fixes * Fixed wrong assignment in `getCardsOver` * Cleanup `getPriceStyle` --- lib/Flux/Item.php | 25 +++++++++++-------------- lib/Flux/Template.php | 25 +++++-------------------- 2 files changed, 16 insertions(+), 34 deletions(-) diff --git a/lib/Flux/Item.php b/lib/Flux/Item.php index e2db41a0..9c0b508a 100644 --- a/lib/Flux/Item.php +++ b/lib/Flux/Item.php @@ -1,6 +1,4 @@ option_id0) - ++$c; + ++$opt; if ($item->option_id1) - ++$c; + ++$opt; if ($item->option_id2) - ++$c; + ++$opt; if ($item->option_id3) - ++$c; + ++$opt; if ($item->option_id4) - ++$c; - return $c; + ++$opt; + return $opt; } /** @@ -119,16 +117,16 @@ public function itemIsSpecial($card0) { public function getCardsOver($item) { $cardsOver = -$item->slots; if ($item->card0) { - $item->cardsOver++; + $cardsOver++; } if ($item->card1) { - $item->cardsOver++; + $cardsOver++; } if ($item->card2) { - $item->cardsOver++; + $cardsOver++; } if ($item->card3) { - $item->cardsOver++; + $cardsOver++; } return $cardsOver; } @@ -212,4 +210,3 @@ public function prettyPrint($items, Flux_Template $tmp = null) { } } -?> diff --git a/lib/Flux/Template.php b/lib/Flux/Template.php index 71573036..9acf22a4 100644 --- a/lib/Flux/Template.php +++ b/lib/Flux/Template.php @@ -1448,26 +1448,11 @@ public function showItemRandomOption($item, $idx, $suffix = '') { } public function getPriceStyle($price) { - if ($price >= 1000000000) - return 'price-10'; - if ($price >= 100000000) - return 'price-9'; - if ($price >= 10000000) - return 'price-8'; - if ($price >= 1000000) - return 'price-7'; - if ($price >= 100000) - return 'price-6'; - if ($price >= 10000) - return 'price-5'; - if ($price >= 1000) - return 'price-4'; - if ($price >= 100) - return 'price-3'; - if ($price >= 10) - return 'price-2'; - if ($price >= 1) - return 'price-1'; + for ($i = 0, $min = 1; $i < 11; $i++) { + if ($min > $price) + return 'price-'.$i; + $min *= 10; + } return 'price-0'; } From 8881f326fd39119a1d11b1d88f13ba5cb7d1a14c Mon Sep 17 00:00:00 2001 From: Cydh Ramdh Date: Tue, 10 Jul 2018 21:05:00 +0700 Subject: [PATCH 11/11] Added missing file flux.itemoption.js * Thanks @ecdarreola --- themes/default/js/flux.itemoption.js | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 themes/default/js/flux.itemoption.js diff --git a/themes/default/js/flux.itemoption.js b/themes/default/js/flux.itemoption.js new file mode 100644 index 00000000..a323c762 --- /dev/null +++ b/themes/default/js/flux.itemoption.js @@ -0,0 +1,4 @@ +function toggleOption(idx) +{ + $('#item-options-'+ idx).slideToggle('fast'); +}