From 8927537e465c698f11e06202ceec6a87bc60453e Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sun, 2 Nov 2014 19:55:03 +0300 Subject: hercules: add mob_skill_db parsing. --- hercules/code/server/mobskilldb.py | 51 +++++++++++++++++++++++++++++++++ hercules/convert_server.py | 2 ++ hercules/templates/mob_skill_db.tpl | 56 +++++++++++++++++++++++++++++++++++++ 3 files changed, 109 insertions(+) create mode 100644 hercules/code/server/mobskilldb.py create mode 100644 hercules/templates/mob_skill_db.tpl diff --git a/hercules/code/server/mobskilldb.py b/hercules/code/server/mobskilldb.py new file mode 100644 index 0000000..6f0bf12 --- /dev/null +++ b/hercules/code/server/mobskilldb.py @@ -0,0 +1,51 @@ +# -*- coding: utf8 -*- +# +# Copyright (C) 2014 Evol Online +# Author: Andrei Karas (4144) + +import re + +from code.fileutils import * +from code.stringutils import * + +def convertMobSkillDb(): + srcFile = "oldserverdata/db/mob_skill_db.txt" + dstFile = "newserverdata/db/re/mob_skill_db.txt" + fieldsSplit = re.compile(",") + with open(srcFile, "r") as r: + with open(dstFile, "w") as w: + tpl = readFile("templates/mob_skill_db.tpl") + w.write(tpl) + for line in r: + if len(line) < 2: + w.write(line) + continue + rows = fieldsSplit.split(line) + if len(rows) < 10: + w.write(line) + continue + + for f in xrange(0, len(rows)): + rows[f] = rows[f].strip() + + w.write("{0},{1},{2},{3},{4},{5},{6}," + "{7},{8},{9},{10},{11},{12},{13}," + "{14},{15},,,\n".format( + rows[0], + rows[1], + rows[2], + rows[3], + rows[4], + rows[5], + rows[6], + rows[7], + rows[8], + rows[9], + rows[10], + rows[11], + rows[13], + rows[14], + rows[15], + rows[16] + )) + diff --git a/hercules/convert_server.py b/hercules/convert_server.py index 563ee70..07fadc2 100755 --- a/hercules/convert_server.py +++ b/hercules/convert_server.py @@ -7,6 +7,7 @@ from code.server.consts import * from code.server.itemdb import * from code.server.mobdb import * +from code.server.mobskilldb import * from code.server.npcs import * from code.server.utils import * @@ -16,3 +17,4 @@ convertNpcs() convertMobDb() convertItemDb() convertConsts() +convertMobSkillDb() diff --git a/hercules/templates/mob_skill_db.tpl b/hercules/templates/mob_skill_db.tpl new file mode 100644 index 0000000..d8cc0a4 --- /dev/null +++ b/hercules/templates/mob_skill_db.tpl @@ -0,0 +1,56 @@ +// Mob Skill Database +// Based on Aegis Episode 14.2 +// +// Structure of Database: +// MobID,Dummy value (info only),State,SkillID,SkillLv,Rate,CastTime,Delay,Cancelable,Target,Condition type,Condition value,val1,val2,val3,val4,val5,Emotion,Chat +// +// RATE: the chance of the skill being casted when the condition is fulfilled (10000 = 100%). +// DELAY: the time (in milliseconds) before attempting to recast the same skill. +// +// STATE: +// any (except dead) / idle (in standby) / walk (in movement) / dead (on killed) / +// loot /attack / angry (like attack, except player has not attacked mob yet) / +// chase (following target, after being attacked) / follow (following target, +// without being attacked) / anytarget (attack+angry+chase+follow) +// +// TARGET: +// target (current target) / self / friend / master / randomtarget (any enemy within skill's range) +// +// The following are for ground-skills, a random target tile is selected from the specified area: +// around1 (3x3 area around self) / around2 (5x5 area around self) / +// around3 (7x7 area around self) / around4 (9x9 area around self) / +// around5 (3x3 area around target) / around6 (5x5 area around target) / +// around7 (7x7 area around target) / around8 (9x9 area around target) / +// around = around4 +// +// CONDITION: +// always Unconditional (no condition value). +// onspawn When mob spawns/respawns (no condition value). +// myhpltmaxrate When mob's HP drops to the specified %. +// myhpinrate When mob's HP is in a certain % range (condition value = lower bound, val1 = upper bound). +// mystatuson If mob has the specified abnormality in status. +// mystatusoff If mob has ended the specified abnormality in status. +// friendhpltmaxrate When mob's friend's HP drops to the specified %. +// friendhpinrate When mob's friend's HP is in a certain % range (condition value = lower bound, val1 = upper bound). +// friendstatuson If friend has the specified abnormality in status. +// friendstatusoff If friend has ended the specified abnormality in status. +// attackpcgt When attack PCs become greater than specified number. +// attackpcge When attack PCs become greater than or equal to the specified number. +// slavelt When number of slaves is less than the original specified number. +// slavele When number of slaves is less than or equal to the original specified number. +// closedattacked When close range melee attacked (no condition value). +// longrangeattacked When long range attacked, ex. bows, guns, ranged skills (no condition value). +// skillused When the specified skill is used on the mob. +// afterskill After mob casts the specified skill. +// casttargeted When a target is in cast range (no condition value). +// rudeattacked When mob is rude attacked (no condition value). +// +// Status abnormalities specified through the statuson/statusoff system: +// anybad (any type of state change) / stone / freeze / stun / sleep / +// poison / curse / silence / confusion / blind / hiding / sight (unhidden) +// +// Note: if a negative MobID is provided, the skill will be treated as 'global': +// -1: added for all boss types. +// -2: added for all normal types. +// -4: added for all mobs. + -- cgit v1.2.3-70-g09d2