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(){ +