public void LoadNPCList(string npcList) { string sect = "NPCLIST " + npcList; Script.ScriptSection CharList = dfnTree.FindEntry(sect, Script.DFN_Categories.npc); if (CharList != null) { foreach (Script.TagDataPair t in CharList.TagDataPairs) { if (t.Tag.ToUpper() == "NPCLIST") { LoadNPCList(t.Data.Value); } else { sNpcs.Add(t.Tag); } } } }
public void LoadItemList(string itemList) { string sect = "ITEMLIST " + itemList; Script.ScriptSection ItemList = dfnTree.FindEntry(sect, Script.DFN_Categories.items); if (ItemList != null) { foreach (Script.TagDataPair t in ItemList.TagDataPairs) { if (t.Tag.ToUpper() == "ITEMLIST") { LoadItemList(t.Data.Value); } else { sItems.Add(t.Tag); } } } }
public void Load(Script.ScriptSection toScan) { string UTag; ArrayList tagList = toScan.TagDataPairs; foreach (Script.TagDataPair t in tagList) { UTag = t.Tag.ToUpper(); if (UTag == "NPCLIST") { LoadNPCList(t.Data); } else if (UTag == "NPC") { sNpcs.Add(t.Data.Value); } else if (UTag == "ITEMLIST") { LoadItemList(t.Data); } else if (UTag == "ITEM") { sItems.Add(t.Data.Value); } else if (UTag == "MAXITEMS") { maxispawn = t.Data.ToInt32(); } else if (UTag == "MAXNPCS") { maxcspawn = t.Data.ToInt32(); } else if (UTag == "X1") { x1 = t.Data.ToInt16(); } else if (UTag == "X2") { x2 = t.Data.ToInt16(); } else if (UTag == "Y1") { y1 = t.Data.ToInt16(); } else if (UTag == "Y2") { y2 = t.Data.ToInt16(); } else if (UTag == "MINTIME") { mintime = t.Data.ToUInt08(); } else if (UTag == "MAXTIME") { maxtime = t.Data.ToUInt08(); } else if (UTag == "NAME") { name = t.Data; } else if (UTag == "CALL") { call = t.Data.ToUInt16(); } else if (UTag == "WORLD") { worldNumber = t.Data.ToUInt08(); } else if (UTag == "PREFZ") { prefZ = t.Data.ToInt08(); } } }
public void Load(Script.ScriptSection toParse) { int actgood = -1; short x1 = -1; short x2 = -1; short y1 = -1; short y2 = -1; foreach (Script.TagDataPair t in toParse.TagDataPairs) { string UTag = t.Tag.ToUpper(); switch (t.Tag[0]) { case 'A': if (UTag == "ABWEATH") { weather = t.Data.ToUInt08(); } else if (UTag == "APPEARANCE") { visualAppearance = WorldType.Count; for (WorldType wt = WorldType.Spring; wt < WorldType.Count; wt++) { if (t.Data.Value.ToUpper() == wt.ToString().ToUpper()) { visualAppearance = wt; break; } } if (visualAppearance == WorldType.Count) { visualAppearance = WorldType.Unknown; } } break; case 'b': case 'B': if (UTag == "BUYABLE") { if (actgood > -1) { ((GoodData)goodList[actgood]).BuyValue = t.Data.ToInt32(); } // else // Console.Error( 2, "regions dfn -> You must write BUYABLE after GOOD <num>!" ); } break; case 'c': case 'C': if (UTag == "COLOURMINSKILL") { break; } else if (UTag == "CHANCEFORBIGORE") { chanceFindBigOre = t.Data.ToUInt08(); } else if (UTag == "CHANCEFORCOLOUR") { break; } break; case 'd': case 'D': if (UTag == "DUNGEON") { IsDungeon = (t.Data.ToInt32() == 1); } break; case 'E': if (UTag == "ESCORTS") { // Load the region number in the global array of valid escortable regions // if( t.Data.ToInt32() == 1 ) // cwmWorldState->escortRegions.push_back( regionNum ); } // End - Dupois break; case 'G': if (UTag == "GUARDOWNER") { guardowner = t.Data; } else if (UTag == "GUARDNUM") { break; } else if (UTag == "GUARDLIST") { guardList = t.Data; } else if (UTag == "GUARDED") { IsGuarded = (t.Data.ToInt32() == 1); } else if (UTag == "GATE") { CanGate = (t.Data.ToInt32() == 1); } else if (UTag == "GOOD") { actgood = t.Data.ToInt32(); } break; case 'M': if (UTag == "MIDILIST") { midiList = t.Data.ToUInt16(); } else if (UTag == "MAGICDAMAGE") { CanCastAggressive = (t.Data.ToInt32() == 1); } else if (UTag == "MARK") { CanMark = (t.Data.ToInt32() == 1); } break; case 'N': if (UTag == "NAME") { name = t.Data.Value; // was Substring( 0, 49 ) } else if (UTag == "NUMGUARDS") { numGuards = t.Data.ToUInt16(); } break; case 'o': case 'O': if (UTag == "OREPREF") { // string numPart; string oreName; OrePreference toPush = new OrePreference(); t.Data.Value = t.Data.Value.Trim(); oreName = t.Data.Value.Split(' ')[0]; toPush.OreData.Name = oreName; // toPush.oreIndex = Skills->FindOre( oreName ); // if( toPush.oreIndex != NULL ) // { // if( t.Data.sectionCount( " " ) == 0 ) // toPush.percentChance = 100 / Skills->GetNumberOfOres(); // else // toPush.percentChance = t.Data.section( " ", 1, 1 ).toByte(); orePreferences.Add(toPush); // orePreferences.push_back( toPush ); // orePrefLoaded = true; // } // else // Console.Error( 2, "Invalid ore preference in region %i as %s", regionNum, oreName.c_str() ); } break; case 'R': if (UTag == "RACE") { race = t.Data.ToUInt16(); } else if (UTag == "RECALL") { CanRecall = (t.Data.ToInt32() == 1); } else if (UTag == "RANDOMVALUE") { if (actgood > -1) { GoodData workWith = ((GoodData)goodList[actgood]); string [] tSplit = t.Data.Value.Split(' '); if (tSplit.Length != 1) { workWith.Rand1 = Conversion.ToInt32(tSplit[0]); workWith.Rand2 = Conversion.ToInt32(tSplit[1]); } else { workWith.Rand1 = t.Data.ToInt32(); workWith.Rand2 = workWith.Rand1; } if (workWith.Rand2 < workWith.Rand1) { // Console.Error( 2, " regions dfn -> You must write RANDOMVALUE NUM2[%i] greater than NUM1[%i].", goodList[actgood].rand2, goodList[actgood].rand1 ); workWith.Rand2 = workWith.Rand1 = 0; } } // else // Console.Error( 2, " regions dfn -> You must write RANDOMVALUE after GOOD <num>!" ); } break; case 's': case 'S': if (UTag == "SELLABLE") { if (actgood > -1) { ((GoodData)goodList[actgood]).SellValue = t.Data.ToInt32(); } // else // Console.Error( 2, " regions dfn -> You must write SELLABLE after GOOD <num>!" ); } else if (UTag == "SPAWN") { // UString sect = "PREDEFINED_SPAWN " + t.Data; // ScriptSection *predefSpawn = FileLookup->FindEntry( sect, spawn_def ); // if( predefSpawn == NULL ) // Console.Warning( 2, "Undefined region spawn %s, check your regions.scp and spawn.scp files", t.Data.c_str() ); // else // { // for( UI16 i = 0xFFFF; i > 0; --i ) // { // if( cwmWorldState->spawnRegions.find( i ) != cwmWorldState->spawnRegions.end() ) // { // CSpawnRegion *spawnReg = new CSpawnRegion( i ); // cwmWorldState->spawnRegions[i] = spawnReg; // if( spawnReg != NULL ) // { // spawnReg->SetX1( locations[locations.size() - 1].x1 ); // spawnReg->SetY1( locations[locations.size() - 1].y1 ); // spawnReg->SetX2( locations[locations.size() - 1].x2 ); // spawnReg->SetY2( locations[locations.size() - 1].y2 ); // spawnReg->Load( predefSpawn ); // } // break; // } // } // } } else if (UTag == "SCRIPT") { jsScript = t.Data.ToUInt16(); } break; case 'W': if (UTag == "WORLD") { worldNumber = t.Data.ToUInt08(); } break; case 'x': case 'X': if (UTag == "X1") { x1 = t.Data.ToInt16(); } else if (UTag == "X2") { x2 = t.Data.ToInt16(); } break; case 'y': case 'Y': if (UTag == "Y1") { y1 = t.Data.ToInt16(); } else if (UTag == "Y2") { y2 = t.Data.ToInt16(); locations.Add(new Box(x1, x2, y1, y2)); } break; } } }