Update editor scripts to Gridarta r5480.
git-svn-id: svn://svn.code.sf.net/p/crossfire/code/maps/trunk@10072 282e977c-c81d-0410-88c4-b93c2d0d6712master
parent
548577faef
commit
97ecd9cad0
|
@ -1,325 +1,329 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<script>
|
||||
<name>LegacySpellConverter</name>
|
||||
<code><![CDATA[import java.io.File;
|
||||
import java.util.Iterator;
|
||||
import net.sf.gridarta.gameobject.ArchetypeParser;
|
||||
import net.sf.gridarta.gameobject.ArchetypeSet;
|
||||
import net.sf.gridarta.gameobject.GameObject;
|
||||
import net.sf.gridarta.io.RecursiveFileIterator;
|
||||
import net.sf.gridarta.map.MapSquare;
|
||||
|
||||
int countMapFiles = 0;
|
||||
int countSpellObjects = 0;
|
||||
|
||||
String[] spellMapping = {
|
||||
"spell_magic_bullet", /* 0 */
|
||||
"spell_small_fireball", /* 1 */
|
||||
"spell_medium_fireball", /* 2 */
|
||||
"spell_large_fireball", /* 3 */
|
||||
"spell_burning_hands", /* 4 */
|
||||
"spell_sm_lightning", /* 5 */
|
||||
"spell_large_lightning", /* 6 */
|
||||
"spell_magic_missile", /* 7 */
|
||||
"spell_create_bomb", /* 8 */
|
||||
"spell_summon_golem", /* 9 */
|
||||
"spell_summon_fire_elemental", /* 10 */
|
||||
"spell_summon_earth_elemental", /* 11 */
|
||||
"spell_summon_water_elemental", /* 12 */
|
||||
"spell_summon_air_elemental", /* 13 */
|
||||
"spell_dimension_door", /* 14 */
|
||||
"spell_create_earth_wall", /* 15 */
|
||||
"spell_paralyze", /* 16 */
|
||||
"spell_icestorm", /* 17 */
|
||||
"spell_magic_mapping", /* 18 */
|
||||
"spell_turn_undead", /* 19 */
|
||||
"spell_fear", /* 20 */
|
||||
"spell_poison_cloud", /* 21 */
|
||||
"spell_wonder", /* 22 */
|
||||
"spell_destruction", /* 23 */
|
||||
"spell_perceive_self", /* 24 */
|
||||
"spell_word_of_recall", /* 25 */
|
||||
"spell_invisible", /* 26 */
|
||||
"spell_invisible_to_undead", /* 27 */
|
||||
"spell_probe", /* 28 */
|
||||
"spell_lg_magic_bullet", /* 29 */
|
||||
"spell_improved_invisibility", /* 30 */
|
||||
"spell_holy_word", /* 31 */
|
||||
"spell_minor_healing", /* 32 */
|
||||
"spell_medium_healing", /* 33 */
|
||||
"spell_major_healing", /* 34 */
|
||||
"spell_heal", /* 35 */
|
||||
"spell_create_food", /* 36 */
|
||||
"spell_earth_to_dust", /* 37 */
|
||||
"spell_armour", /* 38 */
|
||||
"spell_strength", /* 39 */
|
||||
"spell_dexterity", /* 40 */
|
||||
"spell_constitution", /* 41 */
|
||||
"spell_charisma", /* 42 */
|
||||
"spell_create_fire_wall", /* 43 */
|
||||
"spell_create_frost_wall", /* 44 */
|
||||
"spell_protection_from_cold", /* 45 */
|
||||
"spell_protection_from_electricity",/* 46 */
|
||||
"spell_protection_from_fire", /* 47 */
|
||||
"spell_protection_from_poison", /* 48 */
|
||||
"spell_protection_from_slow", /* 49 */
|
||||
"spell_protection_from_paralysis", /* 50 */
|
||||
"spell_protection_from_draining", /* 51 */
|
||||
"spell_protection_from_magic", /* 52 */
|
||||
"spell_protection_from_attack", /* 53 */
|
||||
"spell_levitate", /* 54 */
|
||||
"spell_small_speedball", /* 55 */
|
||||
"spell_large_speedball", /* 56 */
|
||||
"spell_hellfire", /* 57 */
|
||||
"spell_dragonbreath", /* 58 */
|
||||
"spell_large_icestorm", /* 59 */
|
||||
"spell_charging", /* 60 */
|
||||
"spell_polymorph", /* 61 */
|
||||
"spell_cancellation", /* 62 */
|
||||
"spell_confusion", /* 63 */
|
||||
"spell_mass_confusion", /* 64 */
|
||||
"spell_summon_pet_monster", /* 65 */
|
||||
"spell_slow", /* 66 */
|
||||
"spell_regenerate_spellpoints", /* 67 */
|
||||
"spell_cure_poison", /* 68 */
|
||||
"spell_protection_from_confusion", /* 69 */
|
||||
"spell_protection_from_cancellation",/* 70 */
|
||||
"spell_protection_from_depletion", /* 71 */
|
||||
"spell_alchemy", /* 72 */
|
||||
"spell_remove_curse", /* 73 */
|
||||
"spell_remove_damnation", /* 74 */
|
||||
"spell_identify", /* 75*/
|
||||
"spell_detect_magic", /* 76 */
|
||||
"spell_detect_monster", /* 77 */
|
||||
"spell_detect_evil", /* 78 */
|
||||
"spell_detect_curse", /* 79 */
|
||||
"spell_heroism", /* 80 */
|
||||
"spell_aggravation", /* 81 */
|
||||
"spell_firebolt", /* 82 */
|
||||
"spell_frostbolt", /* 83 */
|
||||
"spell_shockwave", /* 84 */
|
||||
"spell_color_spray", /* 85 */
|
||||
"spell_haste", /* 86 */
|
||||
"spell_face_of_death", /* 87 */
|
||||
"spell_ball_lightning", /* 88 */
|
||||
"spell_meteor_swarm", /* 89 */
|
||||
"spell_comet", /* 90 */
|
||||
"spell_mystic_fist", /* 91 */
|
||||
"spell_raise_dead", /* 92 */
|
||||
"spell_resurrection", /* 93 */
|
||||
"spell_reincarnation", /* 94 */
|
||||
"spell_immunity_to_cold", /* 95 */
|
||||
"spell_immunity_to_electricity", /* 96 */
|
||||
"spell_immunity_to_fire", /* 97 */
|
||||
"spell_immunity_to_poison", /* 98 */
|
||||
"spell_immunity_to_slow", /* 99 */
|
||||
"spell_immunity_to_paralysis", /* 100 */
|
||||
"spell_immunity_to_draining", /* 101 */
|
||||
"spell_immunity_to_magic", /* 102 */
|
||||
"spell_immunity_to_attack", /* 103 */
|
||||
"spell_invulnerability", /* 104 */
|
||||
"spell_defense", /* 105 */
|
||||
"spell_rune_of_fire", /* 106 */
|
||||
"spell_rune_of_frost", /* 107 */
|
||||
"spell_rune_of_shocking", /* 108 */
|
||||
"spell_rune_of_blasting", /* 109 */
|
||||
"spell_rune_of_death", /* 110 */
|
||||
"spell_marking_rune", /* 111 */
|
||||
"spell_build_director", /* 112 */
|
||||
"spell_create_pool_of_chaos", /* 113 */
|
||||
"spell_build_bullet_wall", /* 114 */
|
||||
"spell_build_lightning_wall", /* 115 */
|
||||
"spell_build_fireball_wall", /* 116 */
|
||||
"spell_magic_rune", /* 117 */
|
||||
"spell_rune_of_magic_drain", /* 118 */
|
||||
"spell_antimagic_rune", /* 119 */
|
||||
"spell_rune_of_transference", /* 120 */
|
||||
"spell_transference", /* 121 */
|
||||
"spell_magic_drain", /* 122 */
|
||||
"spell_counterspell", /* 123 */
|
||||
"spell_disarm", /* 124 */
|
||||
"spell_cure_confusion", /* 125 */
|
||||
"spell_restoration", /* 126 */
|
||||
null, /* 127 */ /* Not implenented as nothing used it */
|
||||
"spell_counterwall", /* 128 */
|
||||
"spell_cause_light_wounds", /* 129 */
|
||||
"spell_cause_medium_wounds", /* 130 */
|
||||
"spell_cause_heavy_wounds", /* 131 */
|
||||
"spell_charm_monsters", /* 132 */
|
||||
"spell_banishment", /* 133 */
|
||||
"spell_create_missile", /* 134 */
|
||||
"spell_show_invisible", /* 135 */
|
||||
"spell_xray", /* 136 */
|
||||
"spell_pacify", /* 137 */
|
||||
"spell_summon_fog", /* 138 */
|
||||
"spell_steambolt", /* 139 */
|
||||
"spell_command_undead", /* 140 */
|
||||
"spell_holy_orb", /* 141 */
|
||||
"spell_summon_avatar", /* 142 */
|
||||
"spell_holy_possession", /* 143 */
|
||||
"spell_bless", /* 144 */
|
||||
"spell_curse", /* 145 */
|
||||
"spell_regeneration", /* 146 */
|
||||
"spell_consecrate", /* 147 */
|
||||
"spell_summon_cult_monsters", /* 148 */
|
||||
"spell_cause_critical_wounds", /* 149 */
|
||||
"spell_holy_wrath", /* 150 */
|
||||
"spell_retributive_strike", /* 151 */
|
||||
"spell_finger_of_death", /* 152 */
|
||||
"spell_insect_plague", /* 153 */
|
||||
"spell_call_holy_servant", /* 154 */
|
||||
"spell_wall_of_thorns", /* 155 */
|
||||
"spell_staff_to_snake", /* 156 */
|
||||
"spell_light", /* 157 */
|
||||
"spell_darkness", /* 158 */
|
||||
"spell_nightfall", /* 159 */
|
||||
"spell_daylight", /* 160 */
|
||||
"spell_sunspear", /* 161 */
|
||||
"spell_faery_fire", /* 162 */
|
||||
"spell_cure_blindness", /* 163 */
|
||||
"spell_dark_vision", /* 164 */
|
||||
"spell_bullet_swarm", /* 165 */
|
||||
"spell_bullet_storm", /* 166 */
|
||||
"spell_cause_many_wounds", /* 167 */
|
||||
"spell_small_snowstorm", /* 168 */
|
||||
"spell_medium_snowstorm", /* 169 */
|
||||
"spell_large_snowstorm", /* 170 */
|
||||
"spell_cure_disease", /* 171 */
|
||||
"spell_cause_red_death", /* 172 */
|
||||
"spell_cause_flu", /* 173 */
|
||||
"spell_cause_black_death", /* 174 */
|
||||
"spell_cause_leprosy", /* 175 */
|
||||
"spell_cause_smallpox", /* 176 */
|
||||
"spell_cause_white_death", /* 177 */
|
||||
"spell_cause_anthrax", /* 178 */
|
||||
"spell_cause_typhoid", /* 179 */
|
||||
"spell_mana_blast", /* 180 */
|
||||
"spell_small_manaball", /* 181 */
|
||||
"spell_medium_manaball", /* 182 */
|
||||
"spell_large_manaball", /* 183 */
|
||||
"spell_manabolt", /* 184 */
|
||||
"spell_dancing_sword", /* 185 */
|
||||
"spell_animate_weapon", /* 186 */
|
||||
"spell_cause_cold", /* 187 */
|
||||
"spell_divine_shock", /* 188 */
|
||||
"spell_windstorm", /* 189 */
|
||||
"spell_sanctuary", /* 190 */
|
||||
"spell_peace", /* 191 */
|
||||
"spell_spiderweb", /* 192 */
|
||||
"spell_conflict", /* 193 */
|
||||
"spell_rage", /* 194 */
|
||||
"spell_forked_lightning", /* 195 */
|
||||
"spell_poison_fog", /* 196 */
|
||||
"spell_flaming_aura", /* 197 */
|
||||
"spell_vitriol", /* 198 */
|
||||
"spell_vitriol_splash", /* 199 */
|
||||
"spell_iron_skin", /* 200 */
|
||||
"spell_wrathful_eye", /* 201 */
|
||||
"spell_town_portal", /* 202 */
|
||||
"spell_missile_swarm", /* 203 */
|
||||
"spell_cause_rabies", /* 204 */
|
||||
"spell_glyph", /* 205 */
|
||||
};
|
||||
|
||||
void convertGameObject(GameObject gameObject) {
|
||||
Iterator it = gameObject.iterator();
|
||||
while (it.hasNext()) {
|
||||
GameObject invObject = it.next();
|
||||
convertGameObject(invObject);
|
||||
}
|
||||
|
||||
// conversion code based on Crossfire's server/common/loader.l
|
||||
int type = gameObject.getArchTypNr();
|
||||
switch (type) {
|
||||
case 5: // POTION
|
||||
case 18: // ALTAR
|
||||
case 31: // TRIGGER_ALTAR
|
||||
case 154: // RUNE
|
||||
if (gameObject.getAttributeInt("sp") == 0) {
|
||||
// non-spellcasting object ==> skip
|
||||
break;
|
||||
}
|
||||
//fallthrough
|
||||
case 3: // ROD
|
||||
case 35: // HORN
|
||||
case 62: // FIREWALL
|
||||
case 109: // WAND
|
||||
case 111: // SCROLL
|
||||
String spellAttribute = type == 62 ? "dam" : "sp";
|
||||
|
||||
if (!gameObject.iterator().hasNext()) {
|
||||
int spellId = gameObject.getAttributeInt(spellAttribute);
|
||||
if (spellId < 0 || spellId >= spellMapping.length || spellMapping[spellId] == null) {
|
||||
print("invalid spell number " + spellId + " in object " + gameObject.getBestName() + " at " + gameObject.getMapX() + "/" + gameObject.getMapY());
|
||||
} else {
|
||||
GameObject spell = archetypeSet.getOrCreateArchetype(spellMapping[spellId]).createArch();
|
||||
spell.postParseGameObject(0);
|
||||
gameObject.addLast(spell);
|
||||
countSpellObjects++;
|
||||
}
|
||||
}
|
||||
|
||||
gameObject.removeAttribute(spellAttribute);
|
||||
if (gameObject.getArchetype().getAttributeString("randomitems").length() > 0) {
|
||||
gameObject.setAttributeString("randomitems", "none");
|
||||
} else {
|
||||
gameObject.removeAttribute("randomitems");
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void convertMap(File mapFile, String mapPath) {
|
||||
print(mapPath);
|
||||
|
||||
mapControl = mapManager.openMapFile(mapFile, false);
|
||||
if (mapControl == null) {
|
||||
print("Cannot load map file");
|
||||
return;
|
||||
}
|
||||
|
||||
mapControl.getMapModel().beginTransaction("spell conversion");
|
||||
try {
|
||||
Iterator it1 = mapControl.getAllSquares().iterator();
|
||||
while (it1.hasNext()) {
|
||||
MapSquare mapSquare = it1.next();
|
||||
Iterator it2 = mapSquare.iterator();
|
||||
while (it2.hasNext()) {
|
||||
GameObject gameObject = it2.next();
|
||||
convertGameObject(gameObject);
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
mapControl.getMapModel().endTransaction();
|
||||
}
|
||||
|
||||
if (mapControl.isModified()) {
|
||||
countMapFiles++;
|
||||
mapControl.save();
|
||||
}
|
||||
}
|
||||
|
||||
if (baseDirectory == null || baseDirectory.length() <= 0) {
|
||||
baseDirectory = "/";
|
||||
}
|
||||
print("Converting spellcasting objects maps below " + baseDirectory + "...");
|
||||
if (baseDirectory.endsWith("/")) {
|
||||
baseDirectory = baseDirectory.substring(0, baseDirectory.length() - 1);
|
||||
}
|
||||
|
||||
String mapDefaultFolder = globalSettings.getMapDefaultFolder();
|
||||
String rootDirectory = mapDefaultFolder + baseDirectory;
|
||||
Iterator it = new RecursiveFileIterator(new File(rootDirectory));
|
||||
while (it.hasNext()) {
|
||||
File file = it.next();
|
||||
if (file.isFile()
|
||||
&& file.getPath().startsWith(rootDirectory)
|
||||
&& !file.getName().equalsIgnoreCase("README")
|
||||
&& !file.getName().endsWith(".msg")) {
|
||||
convertMap(file, file.getPath().substring(mapDefaultFolder.length()));
|
||||
}
|
||||
}
|
||||
|
||||
<code><![CDATA[import java.io.File;
|
||||
import java.util.Iterator;
|
||||
import net.sf.gridarta.gameobject.ArchetypeParser;
|
||||
import net.sf.gridarta.gameobject.ArchetypeSet;
|
||||
import net.sf.gridarta.gameobject.GameObject;
|
||||
import net.sf.gridarta.io.RecursiveFileIterator;
|
||||
import net.sf.gridarta.map.MapSquare;
|
||||
|
||||
int countMapFiles = 0;
|
||||
int countSpellObjects = 0;
|
||||
|
||||
String[] spellMapping = {
|
||||
"spell_magic_bullet", /* 0 */
|
||||
"spell_small_fireball", /* 1 */
|
||||
"spell_medium_fireball", /* 2 */
|
||||
"spell_large_fireball", /* 3 */
|
||||
"spell_burning_hands", /* 4 */
|
||||
"spell_sm_lightning", /* 5 */
|
||||
"spell_large_lightning", /* 6 */
|
||||
"spell_magic_missile", /* 7 */
|
||||
"spell_create_bomb", /* 8 */
|
||||
"spell_summon_golem", /* 9 */
|
||||
"spell_summon_fire_elemental", /* 10 */
|
||||
"spell_summon_earth_elemental", /* 11 */
|
||||
"spell_summon_water_elemental", /* 12 */
|
||||
"spell_summon_air_elemental", /* 13 */
|
||||
"spell_dimension_door", /* 14 */
|
||||
"spell_create_earth_wall", /* 15 */
|
||||
"spell_paralyze", /* 16 */
|
||||
"spell_icestorm", /* 17 */
|
||||
"spell_magic_mapping", /* 18 */
|
||||
"spell_turn_undead", /* 19 */
|
||||
"spell_fear", /* 20 */
|
||||
"spell_poison_cloud", /* 21 */
|
||||
"spell_wonder", /* 22 */
|
||||
"spell_destruction", /* 23 */
|
||||
"spell_perceive_self", /* 24 */
|
||||
"spell_word_of_recall", /* 25 */
|
||||
"spell_invisible", /* 26 */
|
||||
"spell_invisible_to_undead", /* 27 */
|
||||
"spell_probe", /* 28 */
|
||||
"spell_lg_magic_bullet", /* 29 */
|
||||
"spell_improved_invisibility", /* 30 */
|
||||
"spell_holy_word", /* 31 */
|
||||
"spell_minor_healing", /* 32 */
|
||||
"spell_medium_healing", /* 33 */
|
||||
"spell_major_healing", /* 34 */
|
||||
"spell_heal", /* 35 */
|
||||
"spell_create_food", /* 36 */
|
||||
"spell_earth_to_dust", /* 37 */
|
||||
"spell_armour", /* 38 */
|
||||
"spell_strength", /* 39 */
|
||||
"spell_dexterity", /* 40 */
|
||||
"spell_constitution", /* 41 */
|
||||
"spell_charisma", /* 42 */
|
||||
"spell_create_fire_wall", /* 43 */
|
||||
"spell_create_frost_wall", /* 44 */
|
||||
"spell_protection_from_cold", /* 45 */
|
||||
"spell_protection_from_electricity",/* 46 */
|
||||
"spell_protection_from_fire", /* 47 */
|
||||
"spell_protection_from_poison", /* 48 */
|
||||
"spell_protection_from_slow", /* 49 */
|
||||
"spell_protection_from_paralysis", /* 50 */
|
||||
"spell_protection_from_draining", /* 51 */
|
||||
"spell_protection_from_magic", /* 52 */
|
||||
"spell_protection_from_attack", /* 53 */
|
||||
"spell_levitate", /* 54 */
|
||||
"spell_small_speedball", /* 55 */
|
||||
"spell_large_speedball", /* 56 */
|
||||
"spell_hellfire", /* 57 */
|
||||
"spell_dragonbreath", /* 58 */
|
||||
"spell_large_icestorm", /* 59 */
|
||||
"spell_charging", /* 60 */
|
||||
"spell_polymorph", /* 61 */
|
||||
"spell_cancellation", /* 62 */
|
||||
"spell_confusion", /* 63 */
|
||||
"spell_mass_confusion", /* 64 */
|
||||
"spell_summon_pet_monster", /* 65 */
|
||||
"spell_slow", /* 66 */
|
||||
"spell_regenerate_spellpoints", /* 67 */
|
||||
"spell_cure_poison", /* 68 */
|
||||
"spell_protection_from_confusion", /* 69 */
|
||||
"spell_protection_from_cancellation",/* 70 */
|
||||
"spell_protection_from_depletion", /* 71 */
|
||||
"spell_alchemy", /* 72 */
|
||||
"spell_remove_curse", /* 73 */
|
||||
"spell_remove_damnation", /* 74 */
|
||||
"spell_identify", /* 75*/
|
||||
"spell_detect_magic", /* 76 */
|
||||
"spell_detect_monster", /* 77 */
|
||||
"spell_detect_evil", /* 78 */
|
||||
"spell_detect_curse", /* 79 */
|
||||
"spell_heroism", /* 80 */
|
||||
"spell_aggravation", /* 81 */
|
||||
"spell_firebolt", /* 82 */
|
||||
"spell_frostbolt", /* 83 */
|
||||
"spell_shockwave", /* 84 */
|
||||
"spell_color_spray", /* 85 */
|
||||
"spell_haste", /* 86 */
|
||||
"spell_face_of_death", /* 87 */
|
||||
"spell_ball_lightning", /* 88 */
|
||||
"spell_meteor_swarm", /* 89 */
|
||||
"spell_comet", /* 90 */
|
||||
"spell_mystic_fist", /* 91 */
|
||||
"spell_raise_dead", /* 92 */
|
||||
"spell_resurrection", /* 93 */
|
||||
"spell_reincarnation", /* 94 */
|
||||
"spell_immunity_to_cold", /* 95 */
|
||||
"spell_immunity_to_electricity", /* 96 */
|
||||
"spell_immunity_to_fire", /* 97 */
|
||||
"spell_immunity_to_poison", /* 98 */
|
||||
"spell_immunity_to_slow", /* 99 */
|
||||
"spell_immunity_to_paralysis", /* 100 */
|
||||
"spell_immunity_to_draining", /* 101 */
|
||||
"spell_immunity_to_magic", /* 102 */
|
||||
"spell_immunity_to_attack", /* 103 */
|
||||
"spell_invulnerability", /* 104 */
|
||||
"spell_defense", /* 105 */
|
||||
"spell_rune_of_fire", /* 106 */
|
||||
"spell_rune_of_frost", /* 107 */
|
||||
"spell_rune_of_shocking", /* 108 */
|
||||
"spell_rune_of_blasting", /* 109 */
|
||||
"spell_rune_of_death", /* 110 */
|
||||
"spell_marking_rune", /* 111 */
|
||||
"spell_build_director", /* 112 */
|
||||
"spell_create_pool_of_chaos", /* 113 */
|
||||
"spell_build_bullet_wall", /* 114 */
|
||||
"spell_build_lightning_wall", /* 115 */
|
||||
"spell_build_fireball_wall", /* 116 */
|
||||
"spell_magic_rune", /* 117 */
|
||||
"spell_rune_of_magic_drain", /* 118 */
|
||||
"spell_antimagic_rune", /* 119 */
|
||||
"spell_rune_of_transference", /* 120 */
|
||||
"spell_transference", /* 121 */
|
||||
"spell_magic_drain", /* 122 */
|
||||
"spell_counterspell", /* 123 */
|
||||
"spell_disarm", /* 124 */
|
||||
"spell_cure_confusion", /* 125 */
|
||||
"spell_restoration", /* 126 */
|
||||
null, /* 127 */ /* Not implenented as nothing used it */
|
||||
"spell_counterwall", /* 128 */
|
||||
"spell_cause_light_wounds", /* 129 */
|
||||
"spell_cause_medium_wounds", /* 130 */
|
||||
"spell_cause_heavy_wounds", /* 131 */
|
||||
"spell_charm_monsters", /* 132 */
|
||||
"spell_banishment", /* 133 */
|
||||
"spell_create_missile", /* 134 */
|
||||
"spell_show_invisible", /* 135 */
|
||||
"spell_xray", /* 136 */
|
||||
"spell_pacify", /* 137 */
|
||||
"spell_summon_fog", /* 138 */
|
||||
"spell_steambolt", /* 139 */
|
||||
"spell_command_undead", /* 140 */
|
||||
"spell_holy_orb", /* 141 */
|
||||
"spell_summon_avatar", /* 142 */
|
||||
"spell_holy_possession", /* 143 */
|
||||
"spell_bless", /* 144 */
|
||||
"spell_curse", /* 145 */
|
||||
"spell_regeneration", /* 146 */
|
||||
"spell_consecrate", /* 147 */
|
||||
"spell_summon_cult_monsters", /* 148 */
|
||||
"spell_cause_critical_wounds", /* 149 */
|
||||
"spell_holy_wrath", /* 150 */
|
||||
"spell_retributive_strike", /* 151 */
|
||||
"spell_finger_of_death", /* 152 */
|
||||
"spell_insect_plague", /* 153 */
|
||||
"spell_call_holy_servant", /* 154 */
|
||||
"spell_wall_of_thorns", /* 155 */
|
||||
"spell_staff_to_snake", /* 156 */
|
||||
"spell_light", /* 157 */
|
||||
"spell_darkness", /* 158 */
|
||||
"spell_nightfall", /* 159 */
|
||||
"spell_daylight", /* 160 */
|
||||
"spell_sunspear", /* 161 */
|
||||
"spell_faery_fire", /* 162 */
|
||||
"spell_cure_blindness", /* 163 */
|
||||
"spell_dark_vision", /* 164 */
|
||||
"spell_bullet_swarm", /* 165 */
|
||||
"spell_bullet_storm", /* 166 */
|
||||
"spell_cause_many_wounds", /* 167 */
|
||||
"spell_small_snowstorm", /* 168 */
|
||||
"spell_medium_snowstorm", /* 169 */
|
||||
"spell_large_snowstorm", /* 170 */
|
||||
"spell_cure_disease", /* 171 */
|
||||
"spell_cause_red_death", /* 172 */
|
||||
"spell_cause_flu", /* 173 */
|
||||
"spell_cause_black_death", /* 174 */
|
||||
"spell_cause_leprosy", /* 175 */
|
||||
"spell_cause_smallpox", /* 176 */
|
||||
"spell_cause_white_death", /* 177 */
|
||||
"spell_cause_anthrax", /* 178 */
|
||||
"spell_cause_typhoid", /* 179 */
|
||||
"spell_mana_blast", /* 180 */
|
||||
"spell_small_manaball", /* 181 */
|
||||
"spell_medium_manaball", /* 182 */
|
||||
"spell_large_manaball", /* 183 */
|
||||
"spell_manabolt", /* 184 */
|
||||
"spell_dancing_sword", /* 185 */
|
||||
"spell_animate_weapon", /* 186 */
|
||||
"spell_cause_cold", /* 187 */
|
||||
"spell_divine_shock", /* 188 */
|
||||
"spell_windstorm", /* 189 */
|
||||
"spell_sanctuary", /* 190 */
|
||||
"spell_peace", /* 191 */
|
||||
"spell_spiderweb", /* 192 */
|
||||
"spell_conflict", /* 193 */
|
||||
"spell_rage", /* 194 */
|
||||
"spell_forked_lightning", /* 195 */
|
||||
"spell_poison_fog", /* 196 */
|
||||
"spell_flaming_aura", /* 197 */
|
||||
"spell_vitriol", /* 198 */
|
||||
"spell_vitriol_splash", /* 199 */
|
||||
"spell_iron_skin", /* 200 */
|
||||
"spell_wrathful_eye", /* 201 */
|
||||
"spell_town_portal", /* 202 */
|
||||
"spell_missile_swarm", /* 203 */
|
||||
"spell_cause_rabies", /* 204 */
|
||||
"spell_glyph", /* 205 */
|
||||
};
|
||||
|
||||
void convertGameObject(GameObject gameObject) {
|
||||
Iterator it = gameObject.iterator();
|
||||
while (it.hasNext()) {
|
||||
GameObject invObject = it.next();
|
||||
convertGameObject(invObject);
|
||||
}
|
||||
|
||||
// conversion code based on Crossfire's server/common/loader.l
|
||||
int type = gameObject.getArchTypNr();
|
||||
switch (type) {
|
||||
case 5: // POTION
|
||||
case 18: // ALTAR
|
||||
case 31: // TRIGGER_ALTAR
|
||||
case 154: // RUNE
|
||||
if (gameObject.getAttributeInt("sp") == 0) {
|
||||
// non-spellcasting object ==> skip
|
||||
break;
|
||||
}
|
||||
//fallthrough
|
||||
case 3: // ROD
|
||||
case 35: // HORN
|
||||
case 62: // FIREWALL
|
||||
case 109: // WAND
|
||||
case 111: // SCROLL
|
||||
String spellAttribute = type == 62 ? "dam" : "sp";
|
||||
|
||||
if (!gameObject.iterator().hasNext()) {
|
||||
int spellId = gameObject.getAttributeInt(spellAttribute);
|
||||
if (spellId < 0 || spellId >= spellMapping.length || spellMapping[spellId] == null) {
|
||||
print("invalid spell number " + spellId + " in object " + gameObject.getBestName() + " at " + gameObject.getMapX() + "/" + gameObject.getMapY());
|
||||
} else {
|
||||
GameObject spell = archetypeSet.getOrCreateArchetype(spellMapping[spellId]).createArch();
|
||||
spell.postParseGameObject(0);
|
||||
gameObject.addLast(spell);
|
||||
countSpellObjects++;
|
||||
}
|
||||
}
|
||||
|
||||
gameObject.removeAttribute(spellAttribute);
|
||||
if (gameObject.getArchetype().getAttributeString("randomitems").length() > 0) {
|
||||
gameObject.setAttributeString("randomitems", "none");
|
||||
} else {
|
||||
gameObject.removeAttribute("randomitems");
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void convertMap(File mapFile, String mapPath) {
|
||||
print(mapPath);
|
||||
|
||||
mapControl = mapManager.openMapFile(mapFile, false);
|
||||
if (mapControl == null) {
|
||||
print("Cannot load map file");
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
mapControl.getMapModel().beginTransaction("spell conversion");
|
||||
try {
|
||||
Iterator it1 = mapControl.getAllSquares().iterator();
|
||||
while (it1.hasNext()) {
|
||||
MapSquare mapSquare = it1.next();
|
||||
Iterator it2 = mapSquare.iterator();
|
||||
while (it2.hasNext()) {
|
||||
GameObject gameObject = it2.next();
|
||||
convertGameObject(gameObject);
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
mapControl.getMapModel().endTransaction();
|
||||
}
|
||||
|
||||
if (mapControl.isModified()) {
|
||||
countMapFiles++;
|
||||
mapControl.save();
|
||||
}
|
||||
} finally {
|
||||
mapManager.release(mapControl);
|
||||
}
|
||||
}
|
||||
|
||||
if (baseDirectory == null || baseDirectory.length() <= 0) {
|
||||
baseDirectory = "/";
|
||||
}
|
||||
print("Converting spellcasting objects maps below " + baseDirectory + "...");
|
||||
if (baseDirectory.endsWith("/")) {
|
||||
baseDirectory = baseDirectory.substring(0, baseDirectory.length() - 1);
|
||||
}
|
||||
|
||||
String mapDefaultFolder = globalSettings.getMapDefaultFolder();
|
||||
String rootDirectory = mapDefaultFolder + baseDirectory;
|
||||
Iterator it = new RecursiveFileIterator(new File(rootDirectory));
|
||||
while (it.hasNext()) {
|
||||
File file = it.next();
|
||||
if (file.isFile()
|
||||
&& file.getPath().startsWith(rootDirectory)
|
||||
&& !file.getName().equalsIgnoreCase("README")
|
||||
&& !file.getName().endsWith(".msg")) {
|
||||
convertMap(file, file.getPath().substring(mapDefaultFolder.length()));
|
||||
}
|
||||
}
|
||||
|
||||
print("Done. Created " + countSpellObjects + " spell objects in " + countMapFiles + " map files.");]]></code>
|
||||
<mode>
|
||||
<autoboot>false</autoboot>
|
||||
|
|
|
@ -16,21 +16,25 @@ void normalizeMap(File mapFile, String mapPath) {
|
|||
return;
|
||||
}
|
||||
|
||||
if (!mapPath.startsWith("/styles")
|
||||
&& !mapPath.startsWith("/editor")) {
|
||||
mapModel = map.getMapModel();
|
||||
mapArchObject = mapModel.getMapArchObject();
|
||||
int shrinkFlags = 0;
|
||||
if (mapArchObject.getTilePath(CommonConstants.NORTH).length() <= 0 && mapArchObject.getTilePath(CommonConstants.SOUTH).length() <= 0) {
|
||||
shrinkFlags |= ShrinkMapSizeUtils.SHRINK_EAST;
|
||||
try {
|
||||
if (!mapPath.startsWith("/styles")
|
||||
&& !mapPath.startsWith("/editor")) {
|
||||
mapModel = map.getMapModel();
|
||||
mapArchObject = mapModel.getMapArchObject();
|
||||
int shrinkFlags = 0;
|
||||
if (mapArchObject.getTilePath(CommonConstants.NORTH).length() <= 0 && mapArchObject.getTilePath(CommonConstants.SOUTH).length() <= 0) {
|
||||
shrinkFlags |= ShrinkMapSizeUtils.SHRINK_EAST;
|
||||
}
|
||||
if (mapArchObject.getTilePath(CommonConstants.EAST).length() <= 0 && mapArchObject.getTilePath(CommonConstants.WEST).length() <= 0) {
|
||||
shrinkFlags |= ShrinkMapSizeUtils.SHRINK_SOUTH;
|
||||
}
|
||||
ShrinkMapSizeUtils.shrinkMap(mapModel, shrinkFlags);
|
||||
}
|
||||
if (mapArchObject.getTilePath(CommonConstants.EAST).length() <= 0 && mapArchObject.getTilePath(CommonConstants.WEST).length() <= 0) {
|
||||
shrinkFlags |= ShrinkMapSizeUtils.SHRINK_SOUTH;
|
||||
}
|
||||
ShrinkMapSizeUtils.shrinkMap(mapModel, shrinkFlags);
|
||||
}
|
||||
|
||||
map.save();
|
||||
map.save();
|
||||
} finally {
|
||||
mapManager.release(map);
|
||||
}
|
||||
}
|
||||
|
||||
if (baseDirectory == null || baseDirectory.length() <= 0) {
|
||||
|
|
|
@ -25,14 +25,16 @@ void checkMap(File mapFile, String mapPath) {
|
|||
log("- cannot load map file");
|
||||
return;
|
||||
}
|
||||
|
||||
ErrorCollector errorCollector;
|
||||
try {
|
||||
validators.validateAll(map.getMapModel());
|
||||
} finally {
|
||||
errorCollector = map.getMapModel().getErrors();
|
||||
if (map.nViews() <= 0) {
|
||||
mapManager.closeLevel(map);
|
||||
try {
|
||||
validators.validateAll(map.getMapModel());
|
||||
} finally {
|
||||
errorCollector = map.getMapModel().getErrors();
|
||||
}
|
||||
} finally {
|
||||
mapManager.release(map);
|
||||
}
|
||||
|
||||
StringBuffer sb = new StringBuffer();
|
||||
|
|
|
@ -1,152 +1,150 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<script>
|
||||
<name>WorldMaker</name>
|
||||
<code><![CDATA[import cfeditor.IGUIConstants;
|
||||
import java.io.IOException;
|
||||
import javax.imageio.ImageIO;
|
||||
import java.io.RandomAccessFile;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.File;
|
||||
import java.nio.MappedByteBuffer;
|
||||
import java.nio.channels.FileChannel;
|
||||
|
||||
|
||||
/*
|
||||
* Functions declaration
|
||||
*/
|
||||
File getSimpleFilename(File mapFile) {
|
||||
String mapFilename = mapFile.getPath();
|
||||
int i = mapFilename.lastIndexOf(File.separator);
|
||||
if (i > 0) {
|
||||
mapFilename = mapFilename.substring(i + 1);
|
||||
}
|
||||
return new File(mapFilename);
|
||||
}
|
||||
|
||||
File getPngImageFilename(File mapFile) {
|
||||
return new File(Location + PictureDirectory + getSimpleFilename(mapFile) + ".png");
|
||||
}
|
||||
|
||||
boolean updateMap(File mapFile, File pictureFile) {
|
||||
if (!mapFile.exists()) {
|
||||
return false;
|
||||
}
|
||||
if (pictureFile.exists() && pictureFile.lastModified() >= mapFile.lastModified()) {
|
||||
return false;
|
||||
}
|
||||
print("converting " + mapFile + " to " + pictureFile + ".");
|
||||
map = mapManager.openMapFile(mapFile, false);
|
||||
if (map == null) {
|
||||
return false;
|
||||
}
|
||||
try {
|
||||
try {
|
||||
ImageIO.write(map.getRenderer().getFullImage(), "png", pictureFile);
|
||||
} catch (IOException ex) {
|
||||
print("cannot write " + pictureFile + ": " + ex.getMessage());
|
||||
return false;
|
||||
}
|
||||
} finally {
|
||||
if (map.nViews() <= 0) {
|
||||
mapManager.closeLevel(map);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
boolean runCommand(String cmd) {
|
||||
f = File.createTempFile("WMaker", ".sh");
|
||||
FileWriter out = new FileWriter(f);
|
||||
out.write(cmd);
|
||||
out.close();
|
||||
print("running " + cmd);
|
||||
Process p = Runtime.getRuntime().exec("sh " + f.getAbsolutePath());
|
||||
p.waitFor();
|
||||
f.delete();
|
||||
return p.exitValue() == 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Running code
|
||||
*/
|
||||
void checkDaList() {
|
||||
DestWidth = TileWidth.intValue() * NumX.intValue();
|
||||
DestHeight = TileHeight.intValue() * NumY.intValue();
|
||||
|
||||
if (Location == null || Location.length() < 1) {
|
||||
Location = globalSettings.getMapDefaultFolder();
|
||||
print("autodetected location " + Location);
|
||||
}
|
||||
|
||||
print("World map will be " + DestWidth + "x" + DestHeight + " in size");
|
||||
if (!Location.endsWith(File.separator)) {
|
||||
Location = Location + File.separator;
|
||||
}
|
||||
|
||||
if (!PictureDirectory.endsWith(File.separator)) {
|
||||
PictureDirectory = PictureDirectory + File.separator;
|
||||
}
|
||||
new File(Location + PictureDirectory).mkdirs();
|
||||
|
||||
HashSet mapList = new HashSet();
|
||||
boolean firstRun = false;
|
||||
print("...");
|
||||
long headerSize = ("P6\n"+DestWidth+" "+DestHeight+"\n255\n").getBytes().length;
|
||||
print("...");
|
||||
if (new File(Location + PictureDirectory + WorldPicture + ".ppm").exists()) {
|
||||
runCommand("cp " + Location + PictureDirectory + WorldPicture + ".ppm /tmp/tmp.ppm");
|
||||
} else {
|
||||
File f = new File("/tmp/tmp.ppm");
|
||||
String header = "P6\n"+DestWidth+" "+DestHeight+"\n255\n" ;
|
||||
print("generating empty picture");
|
||||
FileOutputStream fos = new FileOutputStream(f,false);
|
||||
fos.write(header.getBytes());
|
||||
byte[] buf = new byte[(int)DestWidth.intValue()*3];
|
||||
for (int i=0;i<DestHeight.intValue();i++) fos.write(buf);
|
||||
fos.close();
|
||||
firstRun = true;
|
||||
}
|
||||
print("gogogo");
|
||||
long toSkip = ("P6\n"+TileWidth+" "+TileHeight+"\n255\n").getBytes().length;
|
||||
RandomAccessFile raf = new RandomAccessFile(new File("/tmp/tmp.ppm"),"rw");
|
||||
FileChannel fc = raf.getChannel();
|
||||
byte[] buf = new byte[3*TileWidth.intValue()*TileHeight.intValue()];
|
||||
|
||||
for (int x = 0; x < NumX.intValue(); x++) {
|
||||
for (int y = 0; y < NumY.intValue(); y++) {
|
||||
currentX = StartX.intValue() + x;
|
||||
currentY = StartY.intValue() + y;
|
||||
currentMap = new File(Location + MapFilename + "_" + currentX + "_" + currentY);
|
||||
currentPicture = getPngImageFilename(currentMap);
|
||||
didUpdate = updateMap(currentMap, currentPicture);
|
||||
if ((didUpdate || firstRun) && currentPicture.exists()) {
|
||||
runCommand("pngtopnm " + currentPicture + " | pnmscale -xysize " + TileWidth + " " + TileHeight + " > /tmp/ppm.tmp");
|
||||
FileInputStream fis = new FileInputStream("/tmp/ppm.tmp");
|
||||
fis.skip(toSkip);
|
||||
fis.read(buf);
|
||||
sx = x * TileWidth.intValue();
|
||||
sy = y * TileHeight.intValue();
|
||||
long index=((long)sy*(long)DestWidth.intValue()+(long)sx)*(long)3+headerSize;
|
||||
for (long row=0; row<TileHeight.intValue();row++){
|
||||
MappedByteBuffer mbb = fc.map(
|
||||
java.nio.channels.FileChannel.MapMode.READ_WRITE,
|
||||
index+row*DestWidth.intValue()*(long)3,
|
||||
TileWidth.intValue()*(long)3
|
||||
);
|
||||
mbb.put(buf,(int)(row*TileWidth.intValue()*3),(int)(TileWidth.intValue()*3));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
raf.close();
|
||||
runCommand("mv /tmp/tmp.ppm " + Location + PictureDirectory + WorldPicture + ".ppm");
|
||||
print("converting to png if possible.\n");
|
||||
runCommand("pnmtopng " + Location + PictureDirectory + WorldPicture + ".ppm > /tmp/tmp.png");
|
||||
runCommand("mv /tmp/tmp.png " + Location + PictureDirectory + WorldPicture + ".png");
|
||||
}
|
||||
|
||||
checkDaList();
|
||||
<code><![CDATA[import cfeditor.IGUIConstants;
|
||||
import java.io.IOException;
|
||||
import javax.imageio.ImageIO;
|
||||
import java.io.RandomAccessFile;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.File;
|
||||
import java.nio.MappedByteBuffer;
|
||||
import java.nio.channels.FileChannel;
|
||||
|
||||
|
||||
/*
|
||||
* Functions declaration
|
||||
*/
|
||||
File getSimpleFilename(File mapFile) {
|
||||
String mapFilename = mapFile.getPath();
|
||||
int i = mapFilename.lastIndexOf(File.separator);
|
||||
if (i > 0) {
|
||||
mapFilename = mapFilename.substring(i + 1);
|
||||
}
|
||||
return new File(mapFilename);
|
||||
}
|
||||
|
||||
File getPngImageFilename(File mapFile) {
|
||||
return new File(Location + PictureDirectory + getSimpleFilename(mapFile) + ".png");
|
||||
}
|
||||
|
||||
boolean updateMap(File mapFile, File pictureFile) {
|
||||
if (!mapFile.exists()) {
|
||||
return false;
|
||||
}
|
||||
if (pictureFile.exists() && pictureFile.lastModified() >= mapFile.lastModified()) {
|
||||
return false;
|
||||
}
|
||||
print("converting " + mapFile + " to " + pictureFile + ".");
|
||||
map = mapManager.openMapFile(mapFile, false);
|
||||
if (map == null) {
|
||||
return false;
|
||||
}
|
||||
try {
|
||||
try {
|
||||
ImageIO.write(map.getRenderer().getFullImage(), "png", pictureFile);
|
||||
} catch (IOException ex) {
|
||||
print("cannot write " + pictureFile + ": " + ex.getMessage());
|
||||
return false;
|
||||
}
|
||||
} finally {
|
||||
mapManager.release(map);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
boolean runCommand(String cmd) {
|
||||
f = File.createTempFile("WMaker", ".sh");
|
||||
FileWriter out = new FileWriter(f);
|
||||
out.write(cmd);
|
||||
out.close();
|
||||
print("running " + cmd);
|
||||
Process p = Runtime.getRuntime().exec("sh " + f.getAbsolutePath());
|
||||
p.waitFor();
|
||||
f.delete();
|
||||
return p.exitValue() == 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Running code
|
||||
*/
|
||||
void checkDaList() {
|
||||
DestWidth = TileWidth.intValue() * NumX.intValue();
|
||||
DestHeight = TileHeight.intValue() * NumY.intValue();
|
||||
|
||||
if (Location == null || Location.length() < 1) {
|
||||
Location = globalSettings.getMapDefaultFolder();
|
||||
print("autodetected location " + Location);
|
||||
}
|
||||
|
||||
print("World map will be " + DestWidth + "x" + DestHeight + " in size");
|
||||
if (!Location.endsWith(File.separator)) {
|
||||
Location = Location + File.separator;
|
||||
}
|
||||
|
||||
if (!PictureDirectory.endsWith(File.separator)) {
|
||||
PictureDirectory = PictureDirectory + File.separator;
|
||||
}
|
||||
new File(Location + PictureDirectory).mkdirs();
|
||||
|
||||
HashSet mapList = new HashSet();
|
||||
boolean firstRun = false;
|
||||
print("...");
|
||||
long headerSize = ("P6\n"+DestWidth+" "+DestHeight+"\n255\n").getBytes().length;
|
||||
print("...");
|
||||
if (new File(Location + PictureDirectory + WorldPicture + ".ppm").exists()) {
|
||||
runCommand("cp " + Location + PictureDirectory + WorldPicture + ".ppm /tmp/tmp.ppm");
|
||||
} else {
|
||||
File f = new File("/tmp/tmp.ppm");
|
||||
String header = "P6\n"+DestWidth+" "+DestHeight+"\n255\n" ;
|
||||
print("generating empty picture");
|
||||
FileOutputStream fos = new FileOutputStream(f,false);
|
||||
fos.write(header.getBytes());
|
||||
byte[] buf = new byte[(int)DestWidth.intValue()*3];
|
||||
for (int i=0;i<DestHeight.intValue();i++) fos.write(buf);
|
||||
fos.close();
|
||||
firstRun = true;
|
||||
}
|
||||
print("gogogo");
|
||||
long toSkip = ("P6\n"+TileWidth+" "+TileHeight+"\n255\n").getBytes().length;
|
||||
RandomAccessFile raf = new RandomAccessFile(new File("/tmp/tmp.ppm"),"rw");
|
||||
FileChannel fc = raf.getChannel();
|
||||
byte[] buf = new byte[3*TileWidth.intValue()*TileHeight.intValue()];
|
||||
|
||||
for (int x = 0; x < NumX.intValue(); x++) {
|
||||
for (int y = 0; y < NumY.intValue(); y++) {
|
||||
currentX = StartX.intValue() + x;
|
||||
currentY = StartY.intValue() + y;
|
||||
currentMap = new File(Location + MapFilename + "_" + currentX + "_" + currentY);
|
||||
currentPicture = getPngImageFilename(currentMap);
|
||||
didUpdate = updateMap(currentMap, currentPicture);
|
||||
if ((didUpdate || firstRun) && currentPicture.exists()) {
|
||||
runCommand("pngtopnm " + currentPicture + " | pnmscale -xysize " + TileWidth + " " + TileHeight + " > /tmp/ppm.tmp");
|
||||
FileInputStream fis = new FileInputStream("/tmp/ppm.tmp");
|
||||
fis.skip(toSkip);
|
||||
fis.read(buf);
|
||||
sx = x * TileWidth.intValue();
|
||||
sy = y * TileHeight.intValue();
|
||||
long index=((long)sy*(long)DestWidth.intValue()+(long)sx)*(long)3+headerSize;
|
||||
for (long row=0; row<TileHeight.intValue();row++){
|
||||
MappedByteBuffer mbb = fc.map(
|
||||
java.nio.channels.FileChannel.MapMode.READ_WRITE,
|
||||
index+row*DestWidth.intValue()*(long)3,
|
||||
TileWidth.intValue()*(long)3
|
||||
);
|
||||
mbb.put(buf,(int)(row*TileWidth.intValue()*3),(int)(TileWidth.intValue()*3));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
raf.close();
|
||||
runCommand("mv /tmp/tmp.ppm " + Location + PictureDirectory + WorldPicture + ".ppm");
|
||||
print("converting to png if possible.\n");
|
||||
runCommand("pnmtopng " + Location + PictureDirectory + WorldPicture + ".ppm > /tmp/tmp.png");
|
||||
runCommand("mv /tmp/tmp.png " + Location + PictureDirectory + WorldPicture + ".png");
|
||||
}
|
||||
|
||||
checkDaList();
|
||||
print("Done!");]]></code>
|
||||
<mode>
|
||||
<autoboot>false</autoboot>
|
||||
|
|
Loading…
Reference in New Issue