commit fb568564a1cd43d3cde050ab544f74298878bed6 Author: @lakelinx Date: Sat Jul 13 07:55:50 2024 -0700 initial diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..8c6e50cb --- /dev/null +++ b/.gitignore @@ -0,0 +1,8 @@ +# Thumb DB Files +*.db +.idea/ +config.php +database.json +.vs/ +.idea +.vscode/ \ No newline at end of file diff --git a/autoloader.php b/autoloader.php new file mode 100644 index 00000000..21a32c9f --- /dev/null +++ b/autoloader.php @@ -0,0 +1,26 @@ +setRoot(__DIR__); +}); \ No newline at end of file diff --git a/config/config.json b/config/config.json new file mode 100644 index 00000000..0975cd9a --- /dev/null +++ b/config/config.json @@ -0,0 +1,53 @@ +{ + "site": { + "title": "Project Aatheria", + "logo": "images/logo.png", + "root_url": "https://alla.aatheria.com/", + "asset_url": "", + "spell_image_path": "images/spells/", + "spell_image_extension": ".png", + "setup": true + }, + "session": { + "cookie_httponly": true, + "cookie_lifetime": 0, + "cookie_use_only_cookies": true, + "cookie_secure": true + }, + "display": { + "php_debug": true, + "items_per_page": 50, + "allow_quests_npc": true, + "display_named_npcs_info": true, + "display_npc_stats": true, + "display_spawn_group_info": true, + "group_npcs_by_name": true, + "show_npc_drop_chances": true, + "show_npcs_attack_speed": true, + "show_npcs_average_damages": true, + "spawngroup_around_range": 100, + "trackable_npcs_only": false, + "hide_invisible_men": true, + "item_add_chance_to_drop": true, + "discovered_items_only": false, + "item_found_info": true, + "display_task_activities": true, + "display_task_info": true, + "merchants_dont_drop_stuff": true, + "sort_zone_level_list": true, + "use_spell_globals": false, + "legacy_spell_icons": true, + "ignore_zones": [ + "load", + "loading", + "load2", + "nektropos", + "arttest", + "apprentice", + "tutorial" + ] + }, + "setup": { + "complete": true + } +} \ No newline at end of file diff --git a/config/config.json.template b/config/config.json.template new file mode 100644 index 00000000..c9e464d8 --- /dev/null +++ b/config/config.json.template @@ -0,0 +1,50 @@ +{ + "site": { + "title": "", + "logo": "images/logo.png", + "root_url": "" + }, + "session": { + "cookie_httponly": true, + "cookie_lifetime": 0, + "cookie_use_only_cookies": true, + "cookie_secure": true + }, + "display": { + "php_debug": false, + "items_per_page": 50, + "allow_quests_npc": true, + "display_named_npcs_info": true, + "display_npc_stats": true, + "display_spawn_group_info": true, + "group_npcs_by_name": true, + "show_npc_drop_chances": true, + "show_npcs_attack_speed": true, + "show_npcs_average_damages": true, + "spawngroup_around_range": 100, + "trackable_npcs_only": false, + "hide_invisible_men": true, + "item_add_chance_to_drop": true, + "discovered_items_only": false, + "item_found_info": true, + "display_task_activities": true, + "display_task_info": true, + "merchants_dont_drop_stuff": true, + "server_max_level": 70, + "sort_zone_level_list": true, + "use_spell_globals": false, + "use_legacy": true, + "ignore_zones": [ + "load", + "loading", + "load2", + "nektropos", + "arttest", + "apprentice", + "tutorial" + ] + }, + "setup": { + "complete": false + } +} \ No newline at end of file diff --git a/config/database.json.template b/config/database.json.template new file mode 100644 index 00000000..93b616d7 --- /dev/null +++ b/config/database.json.template @@ -0,0 +1,16 @@ +{ + "default": { + "host": "127.0.0.1", + "user": "root", + "password": "", + "database": "peq", + "port": 3306 + }, + "content": { + "host": "", + "user": "", + "password": "", + "database": "", + "port": 3306 + } +} \ No newline at end of file diff --git a/config/tables.json b/config/tables.json new file mode 100644 index 00000000..4f5aa50a --- /dev/null +++ b/config/tables.json @@ -0,0 +1,31 @@ +{ + "accounts": "account", + "characters": "character_data", + "factions": "faction_list", + "forage": "forage", + "ground_spawns": "ground_spawns", + "items": "items", + "loot_drops": "lootdrop", + "loot_drop_entries": "lootdrop_entries", + "loot_tables": "loottable", + "loot_table_entries": "loottable_entries", + "merchant_lists": "merchantlist", + "tasks": "tasks", + "task_activities": "task_activities", + "npc_factions": "npc_faction", + "npc_faction_entries": "npc_faction_entries", + "npc_spell_entries": "npc_spells_entries", + "npc_spells": "npc_spells", + "npcs": "npc_types", + "pets": "pets", + "spawns": "spawn2", + "spawn_entries": "spawnentry", + "spawn_groups": "spawngroup", + "recipes": "tradeskill_recipe", + "recipe_entries": "tradeskill_recipe_entries", + "zones": "zone", + "discovered_items": "discovered_items", + "spell_globals": "spell_globals", + "spells": "spells_new", + "zone_connections": "zone_points" +} \ No newline at end of file diff --git a/includes/constants.php b/includes/constants.php new file mode 100644 index 00000000..7bcb31c7 --- /dev/null +++ b/includes/constants.php @@ -0,0 +1,739 @@ + "Ally", + 2 => "Warmly", + 3 => "Kindly", + 4 => "Amiably", + 5 => "Indifferent", + 9 => "Apprehensive", + 8 => "Dubious", + 7 => "Threatenly", + 6 => "Ready to attack", +]; + +// classes +$dbclasses_names = [ + "Warrior", + "Cleric", + "Paladin", + "Ranger", + "Shadowknight", + "Druid", + "Monk", + "Bard", + "Rogue", + "Shaman", + "Necromancer", + "Wizard", + "Magician", + "Enchanter", + "Beastlord", + "Berserker", +]; +$dbclasses = []; +$dbclasses[0] = "Warrior"; +$dbclasses[1] = "Warrior"; +$dbclasses[2] = "Cleric"; +$dbclasses[3] = "Paladin"; +$dbclasses[4] = "Ranger"; +$dbclasses[5] = "Shadown Knight"; +$dbclasses[6] = "Druid"; +$dbclasses[7] = "Monk"; +$dbclasses[8] = "Bard"; +$dbclasses[9] = "Rogue"; +$dbclasses[10] = "Shaman"; +$dbclasses[11] = "Necromancer"; +$dbclasses[12] = "Wizard"; +$dbclasses[13] = "Magician"; +$dbclasses[14] = "Enchanter"; +$dbclasses[15] = "Beastlord"; +$dbclasses[16] = "Berserker"; +$dbclasses[17] = "Banker"; +$dbclasses[20] = "GM Warrior"; +$dbclasses[21] = "GM Cleric"; +$dbclasses[22] = "GM Paladin"; +$dbclasses[23] = "GM Ranger"; +$dbclasses[24] = "GM Shadown Knight"; +$dbclasses[25] = "GM Druid"; +$dbclasses[26] = "GM Monk"; +$dbclasses[27] = "GM Bard"; +$dbclasses[28] = "GM Rogue"; +$dbclasses[29] = "GM Shaman"; +$dbclasses[30] = "GM Necromancer"; +$dbclasses[31] = "GM Wizard"; +$dbclasses[32] = "GM Magician"; +$dbclasses[33] = "GM Enchanter"; +$dbclasses[34] = "GM Beastlord"; +$dbclasses[35] = "GM Berserker"; +$dbclasses[40] = "Banker"; +$dbclasses[41] = "Shopkeeper"; +$dbclasses[59] = "Discord Merchant"; +$dbclasses[60] = "Adventure Recruiter"; +$dbclasses[61] = "Adventure Merchant"; +$dbclasses[63] = "Tribute Master"; +$dbclasses[64] = "Guild Tribute Master"; +$dbclasses[66] = "Guild Bank"; +$dbclasses[67] = "Radiant Crystal Merchant"; +$dbclasses[68] = "Ebon Crystal Merchant"; +$dbclasses[69] = "Fellowships"; +$dbclasses[70] = "Alternate Currency Merchant"; +$dbclasses[71] = "Mercenary Merchant"; + +// Slots +$dbslots = []; +$dbslotsid = []; +$dbslots[4194304] = "Power Source"; +$dbslots[2097152] = "Ammo"; +$dbslots[1048576] = "Waist"; +$dbslots[524288] = "Feet"; +$dbslots[262144] = "Legs"; +$dbslots[131072] = "Chest"; +$dbslots[98304] = "Fingers"; +$dbslots[65536] = "Finger"; +$dbslots[32768] = "Finger"; +$dbslots[16384] = "Secondary"; +$dbslots[8192] = "Primary"; +$dbslots[4096] = "Hands"; +$dbslots[2048] = "Range"; +$dbslots[1536] = "Wrists"; +$dbslots[1024] = "Wrist"; +$dbslots[512] = "Wrist"; +$dbslots[256] = "Back"; +$dbslots[128] = "Arms"; +$dbslots[64] = "Shoulders"; +$dbslots[32] = "Neck"; +$dbslots[18] = "Ears"; +$dbslots[16] = "Ear"; +$dbslots[8] = "Face"; +$dbslots[4] = "Head"; +$dbslots[2] = "Ear"; +$dbslots[1] = "Charm"; + +// ItemClasses 2^(class-1) +$dbiclasses = []; +$dbiclasses[65535] = "All classes"; +$dbiclasses[32768] = "Berserker"; +$dbiclasses[16384] = "Beastlord"; +$dbiclasses[8192] = "Enchanter"; +$dbiclasses[4096] = "Magician"; +$dbiclasses[2048] = "Wizard"; +$dbiclasses[1024] = "Necromancer"; +$dbiclasses[512] = "Shaman"; +$dbiclasses[256] = "Rogue"; +$dbiclasses[128] = "Bard"; +$dbiclasses[64] = "Monk"; +$dbiclasses[32] = "Druid"; +$dbiclasses[16] = "Shadow knight"; +$dbiclasses[8] = "Ranger"; +$dbiclasses[4] = "Paladin"; +$dbiclasses[2] = "Cleric"; +$dbiclasses[1] = "Warrior"; + +$db_classes_short = []; +$db_classes_short[65535] = "ALL"; +$db_classes_short[32768] = "BER"; +$db_classes_short[16384] = "BST"; +$db_classes_short[8192] = "ENC"; +$db_classes_short[4096] = "MAG"; +$db_classes_short[2048] = "WIZ"; +$db_classes_short[1024] = "NEC"; +$db_classes_short[512] = "SHM"; +$db_classes_short[256] = "ROG"; +$db_classes_short[128] = "BRD"; +$db_classes_short[64] = "MNK"; +$db_classes_short[32] = "DRU"; +$db_classes_short[16] = "SHD"; +$db_classes_short[8] = "RNG"; +$db_classes_short[4] = "PAL"; +$db_classes_short[2] = "CLR"; +$db_classes_short[1] = "WAR"; + +// races +$dbraces = []; +$dbraces[65535] = "All races"; +$dbraces[32768] = "Drakkin"; +$dbraces[16384] = "Froglok"; +$dbraces[8192] = "Vah Shir"; +$dbraces[4096] = "Iksar"; +$dbraces[2048] = "Gnome"; +$dbraces[1024] = "Halfling"; +$dbraces[512] = "Ogre"; +$dbraces[256] = "Troll"; +$dbraces[128] = "Dwarf"; +$dbraces[64] = "Half Elf"; +$dbraces[32] = "Dark Elf"; +$dbraces[16] = "High Elf"; +$dbraces[8] = "Wood Elf"; +$dbraces[4] = "Erudite"; +$dbraces[2] = "Barbarian"; +$dbraces[1] = "Human"; + +$db_races_short = []; +$db_races_short[65535] = "ALL"; +$db_races_short[32768] = "DRK"; +$db_races_short[16384] = "FRG"; +$db_races_short[8192] = "VAH"; +$db_races_short[4096] = "IKS"; +$db_races_short[2048] = "GNM"; +$db_races_short[1024] = "HFL"; +$db_races_short[512] = "OGR"; +$db_races_short[256] = "TRL"; +$db_races_short[128] = "DWF"; +$db_races_short[64] = "HLF"; +$db_races_short[32] = "DKE"; +$db_races_short[16] = "HEF"; +$db_races_short[8] = "WLF"; +$db_races_short[4] = "ERU"; +$db_races_short[2] = "BAR"; +$db_races_short[1] = "HUM"; + +// skills +$dbskills = []; +$dbskills[0] = '1H_BLUNT'; +$dbskills[1] = '1H_SLASHING'; +$dbskills[2] = '2H_BLUNT'; +$dbskills[3] = '2H_SLASHING'; +$dbskills[4] = 'ABJURATION'; +$dbskills[5] = 'ALTERATION'; +$dbskills[6] = 'APPLY_POISON'; +$dbskills[7] = 'ARCHERY'; +$dbskills[8] = 'BACKSTAB'; +$dbskills[9] = 'BIND_WOUND'; +$dbskills[10] = 'BASH'; +$dbskills[11] = 'BLOCKSKILL'; +$dbskills[12] = 'BRASS_INSTRUMENTS'; +$dbskills[13] = 'CHANNELING'; +$dbskills[14] = 'CONJURATION'; +$dbskills[15] = 'DEFENSE'; +$dbskills[16] = 'DISARM'; +$dbskills[17] = 'DISARM_TRAPS'; +$dbskills[18] = 'DIVINATION'; +$dbskills[19] = 'DODGE'; +$dbskills[20] = 'DOUBLE_ATTACK'; +$dbskills[21] = 'DRAGON_PUNCH'; +$dbskills[22] = 'DUEL_WIELD'; +$dbskills[23] = 'EAGLE_STRIKE'; +$dbskills[24] = 'EVOCATION'; +$dbskills[25] = 'FEIGN_DEATH'; +$dbskills[26] = 'FLYING_KICK'; +$dbskills[27] = 'FORAGE'; +$dbskills[28] = 'HAND_TO_HAND'; +$dbskills[29] = 'HIDE'; +$dbskills[30] = 'KICK'; +$dbskills[31] = 'MEDITATE'; +$dbskills[32] = 'MEND'; +$dbskills[33] = 'OFFENSE'; +$dbskills[34] = 'PARRY'; +$dbskills[35] = 'PICK_LOCK'; +$dbskills[36] = 'PIERCING'; +$dbskills[37] = 'RIPOSTE'; +$dbskills[38] = 'ROUND_KICK'; +$dbskills[39] = 'SAFE_FALL'; +$dbskills[40] = 'SENSE_HEADING'; +$dbskills[41] = 'SINGING'; +$dbskills[42] = 'SNEAK'; +$dbskills[43] = 'SPECIALIZE_ABJURE'; +$dbskills[44] = 'SPECIALIZE_ALTERATION'; +$dbskills[45] = 'SPECIALIZE_CONJURATION'; +$dbskills[46] = 'SPECIALIZE_DIVINATION'; +$dbskills[47] = 'SPECIALIZE_EVOCATION'; +$dbskills[48] = 'PICK_POCKETS'; +$dbskills[49] = 'STRINGED_INSTRUMENTS'; +$dbskills[50] = 'SWIMMING'; +$dbskills[51] = 'THROWING'; +$dbskills[52] = 'CLICKY'; +$dbskills[53] = 'TRACKING'; +$dbskills[54] = 'WIND_INSTRUMENTS'; +$dbskills[55] = 'FISHING'; +$dbskills[56] = 'POISON_MAKING'; +$dbskills[57] = 'TINKERING'; +$dbskills[58] = 'RESEARCH'; +$dbskills[59] = 'ALCHEMY'; +$dbskills[60] = 'BAKING'; +$dbskills[61] = 'TAILORING'; +$dbskills[62] = 'SENSE_TRAPS'; +$dbskills[63] = 'BLACKSMITHING'; +$dbskills[64] = 'FLETCHING'; +$dbskills[65] = 'BREWING'; +$dbskills[66] = 'ALCOHOL_TOLERANCE'; +$dbskills[67] = 'BEGGING'; +$dbskills[68] = 'JEWELRY_MAKING'; +$dbskills[69] = 'POTTERY'; +$dbskills[70] = 'PERCUSSION_INSTRUMENTS'; +$dbskills[71] = 'INTIMIDATION'; +$dbskills[72] = 'BERSERKING'; +$dbskills[73] = 'TAUNT'; + +// spell effects +$dbspelleffects = []; + +$dbspelleffects[28] = 'Invisibility versus Undead'; +$dbspelleffects[29] = 'Invisibility versus Animals'; +$dbspelleffects[30] = 'Frenzy Radius'; +$dbspelleffects[31] = 'Mesmerize'; +$dbspelleffects[32] = 'Summon Item'; +$dbspelleffects[33] = 'Summon Pet:'; +$dbspelleffects[35] = 'Increase Disease Counter'; +$dbspelleffects[36] = 'Increase Poison Counter'; +$dbspelleffects[40] = 'Invunerability'; +$dbspelleffects[41] = 'Destroy Target'; +$dbspelleffects[42] = 'Shadowstep'; +$dbspelleffects[44] = 'Lycanthropy'; +$dbspelleffects[46] = 'Increase Fire Resist'; +$dbspelleffects[47] = 'Increase Cold Resist'; +$dbspelleffects[48] = 'Increase Poison Resist'; +$dbspelleffects[49] = 'Increase Disease Resist'; +$dbspelleffects[50] = 'Increase Magic Resist'; +$dbspelleffects[52] = 'Sense Undead'; +$dbspelleffects[53] = 'Sense Summoned'; +$dbspelleffects[54] = 'Sense Animals'; +$dbspelleffects[55] = 'Increase Absorb Damage'; +$dbspelleffects[56] = 'True North'; +$dbspelleffects[57] = 'Levitate'; +$dbspelleffects[58] = 'Illusion:'; +$dbspelleffects[59] = 'Increase Damage Shield'; +$dbspelleffects[61] = 'Identify'; +$dbspelleffects[63] = 'Memblur'; +$dbspelleffects[64] = 'SpinStun'; +$dbspelleffects[65] = 'Infravision'; +$dbspelleffects[66] = 'Ultravision'; +$dbspelleffects[67] = 'Eye Of Zomm'; +$dbspelleffects[68] = 'Reclaim Energy'; +$dbspelleffects[69] = 'Increase Max Hitpoints'; +$dbspelleffects[71] = 'Summon Skeleton Pet:'; +$dbspelleffects[73] = 'Bind Sight'; +$dbspelleffects[74] = 'Feign Death'; +$dbspelleffects[75] = 'Voice Graft'; +$dbspelleffects[76] = 'Sentinel'; +$dbspelleffects[77] = 'Locate Corpse'; +$dbspelleffects[78] = 'Increase Absorb Magic Damage'; +$dbspelleffects[79] = 'Increase HP when cast'; +$dbspelleffects[81] = 'Resurrect'; +$dbspelleffects[82] = 'Summon PC'; +$dbspelleffects[83] = 'Teleport'; +$dbspelleffects[85] = 'Add Proc:'; +$dbspelleffects[86] = 'Reaction Radius'; +$dbspelleffects[87] = 'Increase Magnification'; +$dbspelleffects[88] = 'Evacuate'; +$dbspelleffects[89] = 'Increase Player Size'; +$dbspelleffects[90] = 'Cloak'; +$dbspelleffects[91] = 'Summon Corpse'; +$dbspelleffects[92] = 'Increase hate'; +$dbspelleffects[93] = 'Stop Rain'; +$dbspelleffects[94] = 'Make Fragile (Delete if combat)'; +$dbspelleffects[95] = 'Sacrifice'; +$dbspelleffects[96] = 'Silence'; +$dbspelleffects[97] = 'Increase Mana Pool'; +$dbspelleffects[98] = 'Increase Haste v2'; +$dbspelleffects[99] = 'Root'; +$dbspelleffects[100] = 'Increase Hitpoints v2'; +$dbspelleffects[101] = 'Complete Heal (with duration)'; +$dbspelleffects[102] = 'Fearless'; +$dbspelleffects[103] = 'Call Pet'; +$dbspelleffects[104] = 'Translocate target to their bind point'; +$dbspelleffects[105] = 'Anti-Gate'; +$dbspelleffects[106] = 'Summon Warder:'; +$dbspelleffects[108] = 'Summon Familiar:'; +$dbspelleffects[109] = 'Summon Item v2'; +$dbspelleffects[111] = 'Increase All Resists'; +$dbspelleffects[112] = 'Increase Effective Casting Level'; +$dbspelleffects[113] = 'Summon Horse:'; +$dbspelleffects[114] = 'Increase Agro Multiplier'; +$dbspelleffects[115] = 'Food/Water'; +$dbspelleffects[116] = 'Decrease Curse Counter'; +$dbspelleffects[117] = 'Make Weapons Magical'; +$dbspelleffects[118] = 'Increase Singing Skill'; +$dbspelleffects[119] = 'Increase Haste v3'; +$dbspelleffects[120] = 'Set Healing Effectiveness'; +$dbspelleffects[121] = 'Reverse Damage Shield'; +$dbspelleffects[123] = 'Screech'; +$dbspelleffects[124] = 'Increase Spell Damage'; +$dbspelleffects[125] = 'Increase Spell Healing'; +$dbspelleffects[127] = 'Increase Spell Haste'; +$dbspelleffects[128] = 'Increase Spell Duration'; +$dbspelleffects[129] = 'Increase Spell Range'; +$dbspelleffects[130] = 'Decrease Spell/Bash Hate'; +$dbspelleffects[131] = 'Decrease Chance of Using Reagent'; +$dbspelleffects[132] = 'Decrease Spell Mana Cost'; +$dbspelleffects[134] = 'Limit: Max Level'; +$dbspelleffects[135] = 'Limit: Resist(Magic allowed)'; +$dbspelleffects[136] = 'Limit: Target'; +$dbspelleffects[137] = 'Limit: Effect(Hitpoints allowed)'; +$dbspelleffects[138] = 'Limit: Spell Type(Detrimental only)'; +$dbspelleffects[139] = 'Limit: Spell'; +$dbspelleffects[140] = 'Limit: Min Duration'; +$dbspelleffects[141] = 'Limit: Instant spells only'; +$dbspelleffects[142] = 'LimitMinLevel'; +$dbspelleffects[143] = 'Limit: Min Casting Time'; +$dbspelleffects[145] = 'Teleport v2'; +$dbspelleffects[147] = 'Increase Hitpoints'; +$dbspelleffects[148] = 'Block new spell'; +$dbspelleffects[149] = 'Stacking: Overwrite existing spell'; +$dbspelleffects[150] = 'Death Save - Restore Full Health'; +$dbspelleffects[151] = 'Suspend Pet - Lose Buffs and Equipment'; +$dbspelleffects[152] = 'Summon Pets:'; +$dbspelleffects[153] = 'Balance Party Health'; +$dbspelleffects[154] = 'Remove Detrimental'; +$dbspelleffects[156] = 'Illusion: Target'; +$dbspelleffects[157] = 'Spell-Damage Shield'; +$dbspelleffects[158] = 'Increase Chance to Reflect Spell'; +$dbspelleffects[159] = 'Decrease Stats'; +$dbspelleffects[167] = 'Pet Power Increase'; +$dbspelleffects[168] = 'Increase Melee Mitigation'; +$dbspelleffects[169] = 'Increase Chance to Critical Hit'; +$dbspelleffects[171] = 'CrippBlowChance'; +$dbspelleffects[172] = 'Increase Chance to Avoid Melee'; +$dbspelleffects[173] = 'Increase Chance to Riposte'; +$dbspelleffects[174] = 'Increase Chance to Dodge'; +$dbspelleffects[175] = 'Increase Chance to Parry'; +$dbspelleffects[176] = 'Increase Chance to Dual Wield'; +$dbspelleffects[177] = 'Increase Chance to Double Attack'; +$dbspelleffects[178] = 'Lifetap from Weapon Damage'; +$dbspelleffects[179] = 'Instrument Modifier'; +$dbspelleffects[180] = 'Increase Chance to Resist Spell'; +$dbspelleffects[181] = 'Increase Chance to Resist Fear Spell'; +$dbspelleffects[182] = 'Hundred Hands Effect'; +$dbspelleffects[183] = 'Increase All Skills Skill Check'; +$dbspelleffects[184] = 'Increase Chance to Hit With all Skills'; +$dbspelleffects[185] = 'Increase All Skills Damage Modifier'; +$dbspelleffects[186] = 'Increase All Skills Minimum Damage Modifier'; +$dbspelleffects[188] = 'Increase Chance to Block'; +$dbspelleffects[192] = 'Increase hate'; +$dbspelleffects[194] = 'Fade'; +$dbspelleffects[195] = 'Stun Resist'; +$dbspelleffects[200] = 'Increase Proc Modifier'; +$dbspelleffects[201] = 'Increase Range Proc Modifier'; +$dbspelleffects[205] = 'Rampage'; +$dbspelleffects[206] = 'Area of Effect Taunt'; +$dbspelleffects[216] = 'Increase Accuracy'; +$dbspelleffects[227] = 'Reduce Skill Timer'; +$dbspelleffects[254] = 'Blank'; +$dbspelleffects[266] = 'Increase Attack Chance'; +$dbspelleffects[273] = 'Increase Critical Dot Chance'; +$dbspelleffects[289] = 'Improved Spell Effect: '; +$dbspelleffects[294] = 'Increase Critial Spell Chance'; +$dbspelleffects[299] = 'Wake the Dead'; +$dbspelleffects[311] = 'Limit: Combat Skills Not Allowed'; +$dbspelleffects[314] = 'Fixed Duration Invisbility (not documented on Lucy)'; +$dbspelleffects[323] = 'Add Defensive Proc:'; +$dbspelleffects[330] = 'Critical Damage Mob'; + + +// spell targets +$dbspelltargets = []; +$dbspelltargets[1] = ""; +$dbspelltargets[2] = "Area of effect over the caster"; +$dbspelltargets[3] = "Group teleport"; +$dbspelltargets[4] = "Area of effect around the caster"; +$dbspelltargets[5] = "Single target"; +$dbspelltargets[6] = "Self only"; +$dbspelltargets[8] = "Area of effect around the target"; +$dbspelltargets[9] = "Animal"; +$dbspelltargets[10] = "Undead only"; +$dbspelltargets[11] = "Summoned beings"; +$dbspelltargets[13] = "Tap"; +$dbspelltargets[14] = "Caster's pet"; +$dbspelltargets[15] = "Target's corpse"; +$dbspelltargets[16] = "Plant"; +$dbspelltargets[17] = "Giant"; +$dbspelltargets[18] = "Dragon"; +$dbspelltargets[24] = "Area of effect on undeads"; +$dbspelltargets[36] = "Area - PC Only"; +$dbspelltargets[40] = "Friendly area of effect"; +$dbspelltargets[41] = "Group"; + +// item skills +$dbiskills = []; +$dbiskills[0] = "One Hand Slash"; +$dbiskills[1] = "Two Hands Slash"; +$dbiskills[2] = "Piercing"; +$dbiskills[3] = "One Hand Blunt"; +$dbiskills[4] = "Two Hands Blunt"; +$dbiskills[45] = "Hand to hand"; + +// item types +$dbitypes = []; +$dbitypes[0] = "1HS"; +$dbitypes[1] = "2HS"; +$dbitypes[2] = "Piercing"; +$dbitypes[3] = "1HB"; +$dbitypes[4] = "2HB"; +$dbitypes[5] = "Archery"; +$dbitypes[6] = "Unknown"; +$dbitypes[7] = "Throwing range items"; +$dbitypes[8] = "Shield"; +$dbitypes[9] = "Unknown"; +$dbitypes[10] = "Armor"; +$dbitypes[11] = "Gems"; +$dbitypes[12] = "Lockpicks"; +$dbitypes[13] = "Unknown"; +$dbitypes[14] = "Food"; +$dbitypes[15] = "Drink"; +$dbitypes[16] = "Light"; +$dbitypes[17] = "Combinable"; +$dbitypes[18] = "Bandages"; +$dbitypes[19] = "Throwing"; +$dbitypes[20] = "Scroll"; +$dbitypes[21] = "Potion"; +$dbitypes[22] = "Unknown"; +$dbitypes[23] = "Wind Instrument"; +$dbitypes[24] = "Stringed Instrument"; +$dbitypes[25] = "Brass Instrument"; +$dbitypes[26] = "Percussion Instrument"; +$dbitypes[27] = "Arrow"; +$dbitypes[28] = "Unknown"; +$dbitypes[29] = "Jewelry"; +$dbitypes[30] = "Skull"; +$dbitypes[31] = "Tome"; +$dbitypes[32] = "Note"; +$dbitypes[33] = "Key"; +$dbitypes[34] = "Coin"; +$dbitypes[35] = "2H Piercing"; +$dbitypes[36] = "Fishing Pole"; +$dbitypes[37] = "Fishing Bait"; +$dbitypes[38] = "Alcohol"; +$dbitypes[39] = "Key (bis)"; +$dbitypes[40] = "Compass"; +$dbitypes[41] = "Unknown"; +$dbitypes[42] = "Poison"; +$dbitypes[43] = "Unknown"; +$dbitypes[44] = "Unknown"; +$dbitypes[45] = "Martial"; +$dbitypes[46] = "Unknown"; +$dbitypes[47] = "Unknown"; +$dbitypes[48] = "Unknown"; +$dbitypes[49] = "Unknown"; +$dbitypes[50] = "Unknown"; +$dbitypes[51] = "Unknown"; +$dbitypes[52] = "Charm"; +$dbitypes[53] = "Unknown"; +$dbitypes[54] = "Augmentation"; + +$dbiaugrestrict[1] = "Armor Only"; +$dbiaugrestrict[2] = "Weapons Only"; +$dbiaugrestrict[3] = "1h Weapons Only"; +$dbiaugrestrict[4] = "2h Weapons Only"; +$dbiaugrestrict[5] = "1h Slash Only"; +$dbiaugrestrict[6] = "1h Blunt Only"; +$dbiaugrestrict[7] = "Piercing Only"; +$dbiaugrestrict[8] = "Hand To Hand Only"; +$dbiaugrestrict[9] = "2h Slash Only"; +$dbiaugrestrict[10] = "2h Blunt Only"; +$dbiaugrestrict[11] = "2h Pierce Only"; +$dbiaugrestrict[12] = "Bows Only"; + +$dbbardskills[23] = "Wind"; +$dbbardskills[24] = "Strings"; +$dbbardskills[25] = "Brass"; +$dbbardskills[26] = "Percussions"; +$dbbardskills[51] = "All instruments"; + +$NPCTypeArray = [ + '###' => 'Boss', + '##' => 'Mini-Boss', + '#' => 'Named', + '~' => 'Quest NPC', + '!' => 'Hidden', + '_' => 'Event Spawned', +]; + +// damage bonuses 2Hands at 65 +//http://lucy.allakhazam.com/dmgbonus.html +$dam2h = [ + 0, + 14, + 14, + 14, + 14, + 14, + 14, + 14, + 14, + 14, // 0->9 + 14, + 14, + 14, + 14, + 14, + 14, + 14, + 14, + 14, + 14, // 10->19 + 14, + 14, + 14, + 14, + 14, + 14, + 14, + 14, + 35, + 35, // 20->29 + 36, + 36, + 37, + 37, + 38, + 38, + 39, + 39, + 40, + 40, // 30->39 + 42, + 42, + 42, + 45, + 45, + 47, + 48, + 49, + 49, + 51, // 40->49 + 51, + 52, + 53, + 54, + 54, + 56, + 56, + 57, + 58, + 59, // 50->59 + 59, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, // 60->69 + 68, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, // 70->79 + 0, + 0, + 0, + 0, + 0, + 80, + 0, + 0, + 0, + 0, // 80->89 + 0, + 0, + 0, + 0, + 0, + 88, + 0, + 0, + 0, + 0, // 90->99 + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, // 100->109 + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, // 110->119 + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, // 120->129 + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, // 130->139 + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, // 140->149 + 132, +]; // 150 + + + diff --git a/includes/functions.php b/includes/functions.php new file mode 100644 index 00000000..630cd7d1 --- /dev/null +++ b/includes/functions.php @@ -0,0 +1,1243 @@ +"; + } + + return; +} + +function wrap_content_box($content) +{ + $return_buffer = ' + + + + +
+ ' . $content . ' +
+ '; + + return $return_buffer; +} + +function display_header($header) +{ + return ' + + ' . $header . ' + + '; +} + +function display_table($content, $width = 500) +{ + $return_buffer = ' + + ' . $content . ' +
+ '; + + return $return_buffer; +} + +function display_row($left, $right = "") +{ + return ' + + ' . $left . ' + ' . $right . ' + + '; +} + +function search_box($name = "", $value = "", $placeholder = "") +{ + return ' + + '; +} + +function strip_underscores($string) +{ + $string = str_replace("_", " ", $string); + + return $string; +} + +function print_query_results( + $mysql_reference_data, + $rows_to_return, + $anchor_link_callout, + $query_description, /* Example: NPCs */ + $object_description, + $href_id_name, + $href_name_attribute, + $extra_field = "", + $extra_field_description = "", + $extra_skill = "" +) { + global $dbskills; + + $mysql_rows_returned = mysqli_num_rows($mysql_reference_data); + if ($mysql_rows_returned > get_max_query_results_count($rows_to_return)) { + $mysql_rows_returned = get_max_query_results_count($rows_to_return); + $more_objects_exist = true; + } else { + $more_objects_exist = false; + } + + if ($mysql_rows_returned == 0) { + $return_buffer .= ""; + } else { + $return_buffer .= "

" . $mysql_rows_returned . " " . ($mysql_rows_returned == 1 ? $query_description : $object_description) . " displayed"; + if ($more_objects_exist) { + $return_buffer .= " More " . $object_description . " exist but you reached the query limit."; + } + $return_buffer .= "

"; + $return_buffer .= ""; + } + + return wrap_content_box($return_buffer); +} + +function get_max_query_results_count($MaxObjects) +{ + if ($MaxObjects == 0) { + $Result = 2147483647; + } else { + $Result = $MaxObjects; + } + + return $Result; +} + +function get_npc_name_human_readable($DbName) +{ + $Result = str_replace( + '-', + '`', + str_replace( + '_', + ' ', + str_replace('#', '', str_replace('!', '', str_replace('~', '', $DbName))) + ) + ); + for ($i = 0; $i < 10; $i++) { + $Result = str_replace($i, '', $Result); + } + + return $Result; +} + +/** Returns the type of NPC based on the name of an NPC from its database-encoded '$DbName'. + */ +function NpcTypeFromName($DbName) +{ + global $NPCTypeArray; + foreach ($NPCTypeArray as $key => $type) { + $KeyCount = substr_count($DbName, $key); + $StringLength = strlen($DbName); + $KeyLength = strlen($key); + if ($KeyCount > 0 && substr($DbName, 0, $KeyLength) == $key) { + return $type; + } + } + + return "Normal"; +} + +// Converts the first letter of each word in $str to upper case and the rest to lower case. +function ucfirstwords($str) +{ + return ucwords(strtolower($str)); +} + +/** Returns the URL in the Wiki to the image illustrating the NPC with ID '$NpcId' + * Returns an empty string if the image does not exist in the Wiki + */ +function NpcImage($WikiServerUrl, $WikiRootName, $NpcId) +{ + $SystemCall = "wget -q \"" . $WikiServerUrl . $WikiRootName . "/index.php/Image:Npc-" . $NpcId . ".jpg\" -O -| grep \"/" . $WikiRootName . "/images\" | head -1 | sed 's;.*\\(/" . $WikiRootName . "/images/[^\"]*\\).*;\\1;'"; + $Result = `$SystemCall`; + if ($Result != "") { + $Result = $WikiServerUrl . $Result; + } + + return $Result; +} + +/** Returns a human-readable translation of '$sec' seconds (for respawn times) + * If '$sec' is '0', returns 'time' (prints 'Spawns all the time' as a result) + */ +function translate_time($sec) +{ + if ($sec == 0) { + $Result = "time"; + } else { + $h = floor($sec / 3600); + $m = floor(($sec - $h * 3600) / 60); + $s = $sec - $h * 3600 - $m * 60; + $Result = ($h > 1 ? "$h hours " : "") . ($h == 1 ? "1 hour " : "") . ($m > 0 ? "$m min " : "") . ($s > 0 ? "$s sec" : ""); + } + + return $Result; +} + +/** Returns the rest of the euclidian division of '$d' by '$v' + * Returns '0' if '$v' equals '0' + * Supposes '$d' and '$v' are positive + */ +function modulo($d, $v) +{ + if ($v == 0) { + $Result = 0; + } else { + $s = floor($d / $v); + $Result = $d - $v * $s; + } +} + +/** Returns the list of slot names '$val' corresponds to (as a bit field) + */ +function get_slots_string($val) +{ + global $dbslots; + reset($dbslots); + do { + $key = key($dbslots); + if ($key <= $val) { + $val -= $key; + $Result .= $v . current($dbslots); + $v = ", "; + } + } while (next($dbslots)); + + return $Result; +} + +function get_class_usable_string($val) +{ + global $db_classes_short; + reset($db_classes_short); + do { + $key = key($db_classes_short); + if ($key <= $val) { + $val -= $key; + $res .= $v . current($db_classes_short); + $v = " "; + } + } while (next($db_classes_short)); + + return $res; +} + +function get_race_usable_string($val) +{ + global $db_races_short; + reset($db_races_short); + do { + $key = key($db_races_short); + if ($key <= $val) { + $val -= $key; + $res .= $v . current($db_races_short); + $v = " "; + } + } while (next($db_races_short)); + + return $res; +} + +function get_size_string($val) +{ + switch ($val) { + case 0: + return "Tiny"; + break; + case 1: + return "Small"; + break; + case 2: + return "Medium"; + break; + case 3: + return "Large"; + break; + case 4: + return "Giant"; + break; + default: + return "$val?"; + break; + } +} + +function getspell($id) +{ + global $spells_table, $spell_globals_table, $use_spell_globals; + if ($use_spell_globals == true) { + $query = "SELECT " . $spells_table . ".* FROM " . $spells_table . " WHERE " . $spells_table . ".id=" . $id . " + AND ISNULL((SELECT " . $spell_globals_table . ".spellid FROM " . $spell_globals_table . " + WHERE " . $spell_globals_table . ".spellid = " . $spells_table . ".id))"; + } else { + $query = "SELECT * FROM $spells_table WHERE id=$id"; + } + $result = db_mysql_query($query) or message_die('functions.php', 'getspell', $query, mysqli_error()); + $s = mysqli_fetch_array($result); + + return $s; +} + +function get_deity_usable_string($val) +{ + global $dbideities; + reset($dbideities); + do { + $key = key($dbideities); + if ($key <= $val) { + $val -= $key; + $res .= $v . current($dbideities); + $v = ", "; + } + } while (next($dbideities)); + + return $res; +} + +function SelectMobRace($name, $selected) +{ + global $dbiracenames; + $return_buffer = ""; + + return $return_buffer; +} + +function SelectLevel($name, $maxlevel, $selevel) +{ + $return_buffer = ""; + + return $return_buffer; +} + +function WriteIt($value, $name, $sel) +{ + $return_buffer = "