Untitled
unknown
python
2 years ago
16 kB
16
Indexable
import app
import net
import chr
import chrmgr
import player
import skill
import item
import effect
import constInfo
import localeInfo
import emotion
JOB_WARRIOR = 0
JOB_ASSASSIN = 1
JOB_SURA = 2
JOB_SHAMAN = 3
RACE_WARRIOR_M = 0
RACE_ASSASSIN_W = 1
RACE_SURA_M = 2
RACE_SHAMAN_W = 3
RACE_WARRIOR_W = 4
RACE_ASSASSIN_M = 5
RACE_SURA_W = 6
RACE_SHAMAN_M = 7
COMBO_TYPE_1 = 0
COMBO_TYPE_2 = 1
COMBO_TYPE_3 = 2
COMBO_INDEX_1 = 0
COMBO_INDEX_2 = 1
COMBO_INDEX_3 = 2
COMBO_INDEX_4 = 3
COMBO_INDEX_5 = 4
COMBO_INDEX_6 = 5
HORSE_SKILL_WILDATTACK = chr.MOTION_SKILL+121
HORSE_SKILL_CHARGE = chr.MOTION_SKILL+122
HORSE_SKILL_SPLASH = chr.MOTION_SKILL+123
GUILD_SKILL_DRAGONBLOOD = chr.MOTION_SKILL+101
GUILD_SKILL_DRAGONBLESS = chr.MOTION_SKILL+102
GUILD_SKILL_BLESSARMOR = chr.MOTION_SKILL+103
GUILD_SKILL_SPPEDUP = chr.MOTION_SKILL+104
GUILD_SKILL_DRAGONWRATH = chr.MOTION_SKILL+105
GUILD_SKILL_MAGICUP = chr.MOTION_SKILL+106
PASSIVE_GUILD_SKILL_INDEX_LIST = ( 151, )
ACTIVE_GUILD_SKILL_INDEX_LIST = ( 152, 153, 154, 155, 156, 157, )
naiVoie = "Manager"
PASSIVE_SKILLS_LIST = [ 141, 142, 143 ]
NEW_678TH_SKILL_ENABLE = 0
SKILL_INDEX_DICT = []
def DefineSkillIndexDict():
global NEW_678TH_SKILL_ENABLE
global SKILL_INDEX_DICT
NEW_678TH_SKILL_ENABLE = localeInfo.IsYMIR()
if NEW_678TH_SKILL_ENABLE:
SKILL_INDEX_DICT = {
JOB_WARRIOR : {
1 : (1, 2, 3, 4, 5, 6, 0, 0, 137, 0, 138, 0, 139, 0,),
2 : (16, 17, 18, 19, 20, 21, 0, 0, 137, 0, 138, 0, 139, 0,),
"SUPPORT" : (122, 123, 121, 124, 125, 129, 0, 0, 130, 131, 141, 142, 143,),
},
JOB_ASSASSIN : {
1 : (31, 32, 33, 34, 35, 36, 0, 0, 137, 0, 138, 0, 139, 0, 140,),
2 : (46, 47, 48, 49, 50, 51, 0, 0, 137, 0, 138, 0, 139, 0, 140,),
"SUPPORT" : (122, 123, 121, 124, 125, 129, 0, 0, 130, 131, 141, 142, 143,),
},
JOB_SURA : {
1 : (61, 62, 63, 64, 65, 66, 0, 0, 137, 0, 138, 0, 139, 0,),
2 : (76, 77, 78, 79, 80, 81, 0, 0, 137, 0, 138, 0, 139, 0,),
"SUPPORT" : (122, 123, 121, 124, 125, 129, 0, 0, 130, 131, 141, 142, 143,),
},
JOB_SHAMAN : {
1 : (91, 92, 93, 94, 95, 96, 0, 0, 137, 0, 138, 0, 139, 0,),
2 : (106, 107, 108, 109, 110, 111, 0, 0, 137, 0, 138, 0, 139, 0,),
"SUPPORT" : (122, 123, 121, 124, 125, 129, 0, 0, 130, 131, 141, 142, 143,),
},
}
else:
SKILL_INDEX_DICT = {
JOB_WARRIOR : {
1 : (1, 2, 3, 4, 5, 0, 0, 0, 137, 0, 138, 0, 139, 0,),
2 : (16, 17, 18, 19, 20, 0, 0, 0, 137, 0, 138, 0, 139, 0,),
"SUPPORT" : (122, 123, 121, 124, 125, 129, 0, 0, 130, 131,),
},
JOB_ASSASSIN : {
1 : (31, 32, 33, 34, 35, 0, 0, 0, 137, 0, 138, 0, 139, 0, 140,),
2 : (46, 47, 48, 49, 50, 0, 0, 0, 137, 0, 138, 0, 139, 0, 140,),
"SUPPORT" : (122, 123, 121, 124, 125, 129, 0, 0, 130, 131,),
},
JOB_SURA : {
1 : (61, 62, 63, 64, 65, 66, 0, 0, 137, 0, 138, 0, 139, 0,),
2 : (76, 77, 78, 79, 80, 81, 0, 0, 137, 0, 138, 0, 139, 0,),
"SUPPORT" : (122, 123, 121, 124, 125, 129, 0, 0, 130, 131,),
},
JOB_SHAMAN : {
1 : (91, 92, 93, 94, 95, 96, 0, 0, 137, 0, 138, 0, 139, 0,),
2 : (106, 107, 108, 109, 110, 111, 0, 0, 137, 0, 138, 0, 139, 0,),
"SUPPORT" : (122, 123, 121, 124, 125, 129, 0, 0, 130, 131,),
},
}
def RegisterSkill(race, group, empire=0):
DefineSkillIndexDict()
job = chr.RaceToJob(race)
## Character Skill
if SKILL_INDEX_DICT.has_key(job):
if SKILL_INDEX_DICT[job].has_key(group):
activeSkillList = SKILL_INDEX_DICT[job][group]
for i in xrange(len(activeSkillList)):
skillIndex = activeSkillList[i]
if i != 6 and i != 7:
player.SetSkill(i+1, skillIndex)
supportSkillList = SKILL_INDEX_DICT[job]["SUPPORT"]
for i in xrange(len(supportSkillList)):
player.SetSkill(i+100+1, supportSkillList[i])
## Language Skill
# if 0 != empire:
# languageSkillList = []
# for i in xrange(3):
# if (i+1) != empire:
# languageSkillList.append(player.SKILL_INDEX_LANGUAGE1+i)
# for i in xrange(len(languageSkillList)):
# player.SetSkill(107+i, languageSkillList[i])
## Passive Skills
for i in xrange(len(PASSIVE_SKILLS_LIST)):
player.SetSkill(180+i, PASSIVE_SKILLS_LIST[i])
## Guild Skill
for i in xrange(len(PASSIVE_GUILD_SKILL_INDEX_LIST)):
player.SetSkill(200+i, PASSIVE_GUILD_SKILL_INDEX_LIST[i])
for i in xrange(len(ACTIVE_GUILD_SKILL_INDEX_LIST)):
player.SetSkill(210+i, ACTIVE_GUILD_SKILL_INDEX_LIST[i])
def RegisterSkillAt(race, group, pos, num):
DefineSkillIndexDict()
job = chr.RaceToJob(race)
tmp = list(SKILL_INDEX_DICT[job][group])
tmp[pos] = num
SKILL_INDEX_DICT[job][group] = tuple(tmp)
player.SetSkill(pos+1, num)
FACE_IMAGE_DICT = {
RACE_WARRIOR_M : "d:/ymir work/ui/game/windows/face_warrior.sub",
RACE_ASSASSIN_W : "d:/ymir work/ui/game/windows/face_assassin.sub",
RACE_SURA_M : "d:/ymir work/ui/game/windows/face_sura.sub",
RACE_SHAMAN_W : "d:/ymir work/ui/game/windows/face_shaman.sub",
}
isInitData=0
def SetGeneralMotions(mode, folder):
chrmgr.SetPathName(folder)
chrmgr.RegisterMotionMode(mode)
chrmgr.Gypsy(naiVoie, mode, chr.MOTION_WAIT, "wait.msa")
chrmgr.Gypsy(naiVoie, mode, chr.MOTION_WALK, "walk.msa")
chrmgr.Gypsy(naiVoie, mode, chr.MOTION_RUN, "run.msa")
chrmgr.Gypsy(naiVoie, mode, chr.MOTION_DAMAGE, "damage.msa", 50)
chrmgr.Gypsy(naiVoie, mode, chr.MOTION_DAMAGE, "damage_1.msa", 50)
chrmgr.Gypsy(naiVoie, mode, chr.MOTION_DAMAGE_BACK, "damage_2.msa", 50)
chrmgr.Gypsy(naiVoie, mode, chr.MOTION_DAMAGE_BACK, "damage_3.msa", 50)
chrmgr.Gypsy(naiVoie, mode, chr.MOTION_DAMAGE_FLYING, "damage_flying.msa")
chrmgr.Gypsy(naiVoie, mode, chr.MOTION_STAND_UP, "falling_stand.msa")
chrmgr.Gypsy(naiVoie, mode, chr.MOTION_DAMAGE_FLYING_BACK, "back_damage_flying.msa")
chrmgr.Gypsy(naiVoie, mode, chr.MOTION_STAND_UP_BACK, "back_falling_stand.msa")
chrmgr.Gypsy(naiVoie, mode, chr.MOTION_DEAD, "mori.msa")
chrmgr.Gypsy(naiVoie, mode, chr.MOTION_DIG, "dig.msa")
chrmgr.Gypsy(naiVoie, mode, chr.MOTION_AFK_1, "sit_pre.msa")
chrmgr.Gypsy(naiVoie, mode, chr.MOTION_AFK_2, "sit.msa")
def SetIntroMotions(mode, folder):
chrmgr.SetPathName(folder)
chrmgr.RegisterMotionMode(mode)
chrmgr.Gypsy(naiVoie, mode, chr.MOTION_INTRO_WAIT, "wait.msa")
chrmgr.Gypsy(naiVoie, mode, chr.MOTION_INTRO_SELECTED, "selected.msa")
chrmgr.Gypsy(naiVoie, mode, chr.MOTION_INTRO_NOT_SELECTED, "not_selected.msa")
def __LoadGameSkill():
try:
skill.LoadSkillData()
except:
import exception
exception.Abort("__LoadGameSkill")
# GUILD_BUILDING
def LoadGuildBuildingList(filename):
import uiGuild
uiGuild.BUILDING_DATA_LIST = []
handle = app.OpenTextFile(filename)
count = app.GetTextFileLineCount(handle)
for i in xrange(count):
line = app.GetTextFileLine(handle, i)
tokens = line.split("\t")
TOKEN_VNUM = 0
TOKEN_TYPE = 1
TOKEN_NAME = 2
TOKEN_LOCAL_NAME = 3
NO_USE_TOKEN_SIZE_1 = 4
NO_USE_TOKEN_SIZE_2 = 5
NO_USE_TOKEN_SIZE_3 = 6
NO_USE_TOKEN_SIZE_4 = 7
TOKEN_X_ROT_LIMIT = 8
TOKEN_Y_ROT_LIMIT = 9
TOKEN_Z_ROT_LIMIT = 10
TOKEN_PRICE = 11
TOKEN_MATERIAL = 12
TOKEN_NPC = 13
TOKEN_GROUP = 14
TOKEN_DEPEND_GROUP = 15
TOKEN_ENABLE_FLAG = 16
LIMIT_TOKEN_COUNT = 17
if not tokens[TOKEN_VNUM].isdigit():
continue
if len(tokens) < LIMIT_TOKEN_COUNT:
import dbg
dbg.TraceError("Strange token count [%d/%d] [%s]" % (len(tokens), LIMIT_TOKEN_COUNT, line))
continue
ENABLE_FLAG_TYPE_NOT_USE = False
ENABLE_FLAG_TYPE_USE = True
ENABLE_FLAG_TYPE_USE_BUT_HIDE = 2
if ENABLE_FLAG_TYPE_NOT_USE == int(tokens[TOKEN_ENABLE_FLAG]):
continue
vnum = int(tokens[TOKEN_VNUM])
type = tokens[TOKEN_TYPE]
name = tokens[TOKEN_NAME]
localName = tokens[TOKEN_LOCAL_NAME]
xRotLimit = int(tokens[TOKEN_X_ROT_LIMIT])
yRotLimit = int(tokens[TOKEN_Y_ROT_LIMIT])
zRotLimit = int(tokens[TOKEN_Z_ROT_LIMIT])
price = tokens[TOKEN_PRICE]
material = tokens[TOKEN_MATERIAL]
folderName = ""
if "HEADQUARTER" == type:
folderName = "headquarter"
elif "FACILITY" == type:
folderName = "facility"
elif "OBJECT" == type:
folderName = "object"
elif "WALL" == type:
folderName = "fence"
materialList = ["0", "0", "0"]
if material:
if material[0] == "\"":
material = material[1:]
if material[-1] == "\"":
material = material[:-1]
for one in material.split("/"):
data = one.split(",")
if 2 != len(data):
continue
itemID = int(data[0])
count = data[1]
if itemID == uiGuild.MATERIAL_STONE_ID:
materialList[uiGuild.MATERIAL_STONE_INDEX] = count
elif itemID == uiGuild.MATERIAL_LOG_ID:
materialList[uiGuild.MATERIAL_LOG_INDEX] = count
elif itemID == uiGuild.MATERIAL_PLYWOOD_ID:
materialList[uiGuild.MATERIAL_PLYWOOD_INDEX] = count
chrmgr.RegisterRaceSrcName(name, folderName)
chrmgr.RegisterRaceName(vnum, name)
appendingData = { "VNUM":vnum,
"TYPE":type,
"NAME":name,
"LOCAL_NAME":localName,
"X_ROT_LIMIT":xRotLimit,
"Y_ROT_LIMIT":yRotLimit,
"Z_ROT_LIMIT":zRotLimit,
"PRICE":price,
"MATERIAL":materialList,
"SHOW" : True }
if ENABLE_FLAG_TYPE_USE_BUT_HIDE == int(tokens[TOKEN_ENABLE_FLAG]):
appendingData["SHOW"] = False
uiGuild.BUILDING_DATA_LIST.append(appendingData)
app.CloseTextFile(handle)
# END_OF_GUILD_BUILDING
def __LoadGameEnemy():
pass
def __LoadPass():
pass
loadGameDataDict={
"INIT" : __LoadPass,
"SOUND" : __LoadPass,
"EFFECT" : __LoadPass,
"WARRIOR" : __LoadPass,
"ASSASSIN" : __LoadPass,
"SURA" : __LoadPass,
"SHAMAN" : __LoadPass,
"SKILL" : __LoadPass,
"ENEMY" : __LoadPass,
"NPC" : __LoadPass,
}
def LoadGameData(name):
global loadGameDataDict
load=loadGameDataDict.get(name, 0)
if load:
loadGameDataDict[name]=0
try:
load()
except:
print name
import exception
exception.Abort("LoadGameData")
raise
def SetMovingNPC(race, name):
chrmgr.CreateRace(race)
chrmgr.SelectRace(race)
## RESERVED
chrmgr.SetPathName("d:/ymir work/npc/" + name + "/")
chrmgr.RegisterMotionMode(chr.MOTION_MODE_GENERAL)
chrmgr.Gypsy(naiVoie, chr.MOTION_MODE_GENERAL, chr.MOTION_WAIT, "wait.msa")
chrmgr.Gypsy(naiVoie, chr.MOTION_MODE_GENERAL, chr.MOTION_WALK, "walk.msa")
chrmgr.Gypsy(naiVoie, chr.MOTION_MODE_GENERAL, chr.MOTION_RUN, "run.msa")
chrmgr.Gypsy(naiVoie, chr.MOTION_MODE_GENERAL, chr.MOTION_DEAD, "die.msa")
chrmgr.LoadRaceData(name + ".msm")
def SetOneNPC(race, name):
chrmgr.CreateRace(race)
chrmgr.SelectRace(race)
## RESERVED
chrmgr.SetPathName("d:/ymir work/npc/" + name + "/")
chrmgr.RegisterMotionMode(chr.MOTION_MODE_GENERAL)
chrmgr.Gypsy(naiVoie, chr.MOTION_MODE_GENERAL, chr.MOTION_WAIT, "wait.msa")
chrmgr.LoadRaceData(name + ".msm")
def SetGuard(race, name):
chrmgr.CreateRace(race)
chrmgr.SelectRace(race)
## Script Data
chrmgr.SetPathName("d:/ymir work/npc/" + name + "/")
chrmgr.LoadRaceData(name + ".msm")
## GENERAL
chrmgr.RegisterMotionMode(chr.MOTION_MODE_GENERAL)
chrmgr.Gypsy(naiVoie, chr.MOTION_MODE_GENERAL, chr.MOTION_SPAWN, "00.msa")
chrmgr.Gypsy(naiVoie, chr.MOTION_MODE_GENERAL, chr.MOTION_WAIT, "00.msa")
chrmgr.Gypsy(naiVoie, chr.MOTION_MODE_GENERAL, chr.MOTION_RUN, "03.msa")
chrmgr.Gypsy(naiVoie, chr.MOTION_MODE_GENERAL, chr.MOTION_DAMAGE, "30.msa", 50)
chrmgr.Gypsy(naiVoie, chr.MOTION_MODE_GENERAL, chr.MOTION_DAMAGE, "30_1.msa", 50)
chrmgr.Gypsy(naiVoie, chr.MOTION_MODE_GENERAL, chr.MOTION_DAMAGE_BACK, "34.msa", 50)
chrmgr.Gypsy(naiVoie, chr.MOTION_MODE_GENERAL, chr.MOTION_DAMAGE_BACK, "34_1.msa", 50)
chrmgr.Gypsy(naiVoie, chr.MOTION_MODE_GENERAL, chr.MOTION_DAMAGE_FLYING,"32.msa")
chrmgr.Gypsy(naiVoie, chr.MOTION_MODE_GENERAL, chr.MOTION_STAND_UP, "33.msa")
chrmgr.Gypsy(naiVoie, chr.MOTION_MODE_GENERAL, chr.MOTION_DAMAGE_FLYING_BACK, "35.msa")
chrmgr.Gypsy(naiVoie, chr.MOTION_MODE_GENERAL, chr.MOTION_STAND_UP_BACK, "36.msa")
chrmgr.Gypsy(naiVoie, chr.MOTION_MODE_GENERAL, chr.MOTION_DEAD, "31.msa")
chrmgr.Gypsy(naiVoie, chr.MOTION_MODE_GENERAL, chr.MOTION_DEAD_BACK, "37.msa")
chrmgr.Gypsy(naiVoie, chr.MOTION_MODE_GENERAL, chr.MOTION_NORMAL_ATTACK, "20.msa")
## Attacking Data
chrmgr.RegisterNormalAttack(chr.MOTION_MODE_GENERAL, chr.MOTION_NORMAL_ATTACK)
def SetWarp(race):
chrmgr.CreateRace(race)
chrmgr.SelectRace(race)
chrmgr.SetPathName("d:/ymir work/npc/warp/")
chrmgr.LoadRaceData("warp.msm")
## GENERAL
chrmgr.RegisterMotionMode(chr.MOTION_MODE_GENERAL)
chrmgr.Gypsy(naiVoie, chr.MOTION_MODE_GENERAL, chr.MOTION_WAIT, "wait.msa")
def SetDoor(race, name):
chrmgr.CreateRace(race)
chrmgr.SelectRace(race)
chrmgr.SetPathName("d:/ymir work/npc/"+name+"/")
chrmgr.LoadRaceData(name + ".msm")
chrmgr.RegisterMotionMode(chr.MOTION_MODE_GENERAL)
chrmgr.Gypsy(naiVoie, chr.MOTION_MODE_GENERAL, chr.MOTION_WAIT, "close_wait.msa")
chrmgr.Gypsy(naiVoie, chr.MOTION_MODE_GENERAL, chr.MOTION_DEAD, "open.msa")
def SetGuildBuilding(race, name, grade):
chrmgr.CreateRace(race)
chrmgr.SelectRace(race)
chrmgr.SetPathName("d:/ymir work/guild/building/%s/" % name)
chrmgr.LoadRaceData("%s%02d.msm" % (name, grade))
chrmgr.RegisterMotionMode(chr.MOTION_MODE_GENERAL)
#chrmgr.Gypsy(naiVoie, chr.MOTION_MODE_GENERAL, chr.MOTION_DEAD, name + "_destruction.msa")
def OLD_SetNPC():
SetOneNPC(9001, "arms")
SetOneNPC(9002, "defence")
SetOneNPC(9003, "goods")
SetOneNPC(9004, "bank")
SetOneNPC(9005, "hotel_grandfa")
SetOneNPC(9006, "hotel_grandma")
SetOneNPC(9007, "arms")
SetOneNPC(9008, "defence")
SetOneNPC(9009, "sailor")
SetMovingNPC(20001, "alchemist")
SetMovingNPC(20002, "auntie")
SetMovingNPC(20003, "baby_and_mom")
SetMovingNPC(20004, "beggar")
SetMovingNPC(20005, "ceramist")
SetMovingNPC(20006, "girl_lost_elder_brother")
SetMovingNPC(20007, "hotel_grandfa")
SetMovingNPC(20008, "mr_restaurant")
SetMovingNPC(20009, "oldster")
SetMovingNPC(20010, "peddler")
SetMovingNPC(20011, "plant_researcher")
SetMovingNPC(20012, "rice_cake_seller")
SetMovingNPC(20013, "sailor")
SetMovingNPC(20014, "timid_boy")
SetMovingNPC(20015, "woodcutter")
SetMovingNPC(20016, "blacksmith")
SetMovingNPC(20017, "musician")
SetMovingNPC(20018, "doctor")
SetMovingNPC(20019, "hunter")
SetMovingNPC(20020, "old_pirate")
SetMovingNPC(20021, "widow")
SetMovingNPC(20022, "young_merchant")
SetMovingNPC(20023, "bookworm")
SetMovingNPC(20024, "yu_hwa_rang")
SetMovingNPC(20041, "beggar")
SetMovingNPC(20042, "peddler")
SetGuard(20300, "sinsu_patrol_spear")
SetGuard(20301, "sinsu_patrol_spear")
SetGuard(20302, "sinsu_patrol_spear")
SetGuard(20303, "sinsu_patrol_spear")
SetGuard(20304, "sinsu_patrol_spear")
SetGuard(20305, "sinsu_patrol_spear")
SetGuard(20306, "sinsu_patrol_spear")
SetGuard(20307, "sinsu_patrol_spear")
SetGuard(20320, "gangyo_patrol_spear")
SetGuard(20321, "gangyo_patrol_spear")
SetGuard(20322, "gangyo_patrol_spear")
SetGuard(20323, "gangyo_patrol_spear")
SetGuard(20324, "gangyo_patrol_spear")
SetGuard(20325, "gangyo_patrol_spear")
SetGuard(20326, "gangyo_patrol_spear")
SetGuard(20327, "gangyo_patrol_spear")
SetGuard(20340, "jinno_patrol_spear")
SetGuard(20341, "jinno_patrol_spear")
SetGuard(20342, "jinno_patrol_spear")
SetGuard(20343, "jinno_patrol_spear")
SetGuard(20344, "jinno_patrol_spear")
SetGuard(20345, "jinno_patrol_spear")
SetGuard(20346, "jinno_patrol_spear")
SetGuard(20347, "jinno_patrol_spear")
## Warp
for i in xrange(18):
SetWarp(10001 + i)
SetGuard(11000, "gangyo_patrol_spear")
SetGuard(11001, "gangyo_patrol_bow")
SetGuard(11002, "jinno_patrol_spear")
SetGuard(11003, "jinno_patrol_bow")
SetGuard(11004, "sinsu_patrol_spear")
SetGuard(11005, "sinsu_patrol_bow")
## Campfire (Bonfire)
chrmgr.CreateRace(12000)
chrmgr.SelectRace(12000)
chrmgr.SetPathName("d:/ymir Work/npc/campfire/")
chrmgr.LoadRaceData("campfire.msm")
## Door
SetDoor(000, "wooden_door")
SetDoor(001, "stone_door")
Editor is loading...