1 CREATE OR REPLACE PACKAGE "HOTFIX_1" as
2 procedure StartItemConversion (rbs_to_use varchar2 default null, conversion_id number default 1);
3 procedure DoSingleObject (objectId number, conversion_id number default 1);
7 CREATE OR REPLACE PACKAGE BODY "HOTFIX_1" as
9 type objVarType is record (
10 object_id number := NULL,
11 objvar_name varchar2(500) := NULL,
12 objvar_type number := NULL,
13 objvar_value varchar2(1000) := NULL,
14 objvar_name_id number := 0,
15 old_objvar_name_id number := 0);
17 type objRowType is record (
19 object_template_id number,
20 object_name varchar2(127), name_string_table varchar2(500), name_string_text varchar2(500),
21 objvar_0_name varchar2(50), objvar_0_type number, objvar_0_value varchar2(50),
22 objvar_1_name varchar2(50), objvar_1_type number, objvar_1_value varchar2(50),
23 objvar_2_name varchar2(50), objvar_2_type number, objvar_2_value varchar2(50),
24 objvar_3_name varchar2(50), objvar_3_type number, objvar_3_value varchar2(50),
25 objvar_4_name varchar2(50), objvar_4_type number, objvar_4_value varchar2(50),
26 objvar_5_name varchar2(50), objvar_5_type number, objvar_5_value varchar2(50),
27 objvar_6_name varchar2(50), objvar_6_type number, objvar_6_value varchar2(50),
28 objvar_7_name varchar2(50), objvar_7_type number, objvar_7_value varchar2(50),
29 objvar_8_name varchar2(50), objvar_8_type number, objvar_8_value varchar2(50),
30 objvar_9_name varchar2(50), objvar_9_type number, objvar_9_value varchar2(50),
31 objvar_10_name varchar2(50), objvar_10_type number, objvar_10_value varchar2(50),
32 objvar_11_name varchar2(50), objvar_11_type number, objvar_11_value varchar2(50),
33 objvar_12_name varchar2(50), objvar_12_type number, objvar_12_value varchar2(50),
34 objvar_13_name varchar2(50), objvar_13_type number, objvar_13_value varchar2(50),
35 objvar_14_name varchar2(50), objvar_14_type number, objvar_14_value varchar2(50),
36 objvar_15_name varchar2(50), objvar_15_type number, objvar_15_value varchar2(50),
37 objvar_16_name varchar2(50), objvar_16_type number, objvar_16_value varchar2(50),
38 objvar_17_name varchar2(50), objvar_17_type number, objvar_17_value varchar2(50),
39 objvar_18_name varchar2(50), objvar_18_type number, objvar_18_value varchar2(50),
40 objvar_19_name varchar2(50), objvar_19_type number, objvar_19_value varchar2(50),
41 scriptlist varchar2(2000));
43 type objVarRowType is record (
45 objvar_name_id number,
46 objvar_name varchar2(500),
48 objvar_value varchar2(1000));
50 type weaponRowType is record (
61 elemental_type number,
62 elemental_value number);
64 type manfSchematicRowType is record (
66 draft_schematic number);
68 type manfAttributeRowType is record (
70 attribute varchar2(500),
73 type rangeType is varray(4) of number;
75 type rangeTableType is table of rangeType;
77 type numTable is table of number;
79 type varcharTable is table of varchar2(500);
81 type numTableVarchar is table of number
82 index by varchar2(500);
84 type varcharTableNum is table of varchar2(500)
85 index by binary_integer;
87 type objectObjVarArray is varray(20) of objVarType;
89 type objVarTable is table of objVarType
90 index by varchar2(500);
92 type dotObjVarTable is table of objVarType
93 index by varchar2(10);
95 type dotArrayVarchar is table of dotObjVarTable
96 index by varchar2(500);
98 type numTableNumber is table of number
99 index by binary_integer;
101 type dotsMatrixType is table of numTableNumber index by varchar2(50);
103 type manfAttributesTable is table of manfAttributeRowType
104 index by varchar2(500);
106 -- private global containers
107 use_rbs varchar2(50);
109 free_slots numTable; -- empty OBJECTS ObjVar columns
110 slot_map numTableVarchar; -- map from ObjVar name to OBJECTS slot
111 Obj_ObjVars objectObjVarArray; -- array of ObjVars in OBJECTS
112 OV_ObjVars objVarTable; -- map by name of ObjVars in OBJECT_VARIABLES
113 dot_list dotArrayVarchar; -- map from extracted DoT name and class to ObjVar
114 -- example: dot_list('actionShot1')('type')
115 isObjModified boolean; -- tracks if any of the OBJECTS data has changed
116 updated_objvars varcharTable; -- list of updated ObjVar names in OBJECT_VARIABLES
117 deleted_objvars varcharTable; -- list of deleted ObjVar names in OBJECT_VARIABLES
118 added_objvars varcharTable; -- list of added ObjVar names in OBJECT_VARIABLES
119 isSchematic boolean; -- tracks if the object has MANF_SCHEMATIC_OBJECTS data
121 script_list varchar2(2000);
122 object_name varchar2(127);
123 name_table varchar2(500);
124 name_text varchar2(500);
126 new_template_id number;
127 new_schematic_id number;
130 -- private lookup tables
131 templateIdSet numTableNumber; -- set of template ids to be converted
132 objvarNameIdMap numTableVarchar; -- map from ObjVar name to OBJECT_VARIABLES_NAMES ID
133 schematic_map numTableNumber; -- map of schematic to created template
134 templateNameTable varcharTableNum; -- map of new template ids to string_name_table
135 templateNameText varcharTableNum; -- map of new template ids to string_name_text
139 blankObjVar objVarType; -- can't use CONSTANT properly with records :(
141 -- private function declaration
142 procedure DoItemConversionBatch(start_objectid number, end_objectid number, conversion_id number);
143 function InitializeData return boolean;
145 procedure AddObjVar (objvar_name varchar2, objvar_type number, objvar_value varchar2);
146 procedure DeleteObjVar (objVarName in varchar2);
147 procedure ModifyObjVar (oldObjVarName varchar2, objvar_name varchar2, objvar_type number, objvar_value varchar2);
148 procedure ModifyObjVar (oldObjVarName varchar2, objvar_name varchar2, objvar_type number, rangeTable rangeTableType);
149 procedure RenameObjVar (oldObjVarName varchar2, objvar_name varchar2);
150 function GetObjVarValue (objvar_name varchar2) return varchar2;
151 procedure AddScript (newScript varchar2);
152 procedure RemoveScript (oldScript varchar2);
153 procedure SetNewTemplateId (newTemplateId number);
154 procedure SetTemplateText (newTemplateId number);
155 procedure InvalidateSchematic;
157 procedure SetGenProtection(rangeTable rangeTableType);
158 procedure SetArmorCondLevelCat(condition varchar2, lev varchar2, category varchar2);
159 procedure SetArmorLevel(lev varchar);
160 procedure SetArmorCategory(category varchar2);
161 procedure SetGpAndCond(gp_name varchar2, gp_val varchar2, cond_name varchar2, cond_val varchar2);
163 procedure DeleteCraftingComponents;
165 function ConvertValue (oldvalue number, rangeTable rangeTableType) return number;
167 function SchematicMap(schematic_id number)
170 -- public function definitions
171 procedure StartItemConversion (rbs_to_use varchar2, conversion_id number)
174 startObjectId number := 0;
175 starttime date := sysdate;
177 use_rbs := rbs_to_use;
178 if use_rbs is not null then
179 execute immediate 'set transaction use rollback segment ' || use_rbs;
181 if (InitializeData) then
182 -- loop through all objects in batches
183 select max(object_id) into maxObjectId from objects;
184 while startObjectId < maxObjectId loop
185 dbms_output.put_line('starting batch: ' || startObjectId || ' time = ' || to_char(sysdate, 'MM/DD/YY HH24:MI:SS'));
186 DoItemConversionBatch(startObjectId, startObjectId + 19999999999, conversion_id);
188 if use_rbs is not null then
189 execute immediate 'set transaction use rollback segment ' || use_rbs;
191 startObjectId := startObjectId + 20000000000;
194 dbms_output.put_line('start time = ' || to_char(starttime, 'MM/DD/YY HH24:MI:SS'));
195 dbms_output.put_line('final time = ' || to_char(sysdate, 'MM/DD/YY HH24:MI:SS'));
196 dbms_output.put_line('total time = ' || to_char(trunc((sysdate - starttime)*24*60)) || ' mins');
200 dbms_output.put_line('Error in StartItemConversion - time = ' || to_char(sysdate, 'MM/DD/YY HH24:MI:SS'));
201 db_error_logger.dblogerror(err_num, 'Error in StartItemConversion');
204 procedure DoSingleObject (objectId number, conversion_id number)
207 if (InitializeData) then
208 DoItemConversionBatch(objectId, objectId, conversion_id);
213 dbms_output.put_line('Error in DoSingleObject - time = ' || to_char(sysdate, 'MM/DD/YY HH24:MI:SS'));
214 db_error_logger.dblogerror(err_num, 'Error in ObjVarUpdates');
217 -- private function definitions
218 procedure DoItemConversionBatch(start_objectid number, end_objectid number, conversion_id number)
222 cursor objCursor (start_id number, end_id number) is
225 o.object_template_id,
226 o.object_name, o.name_string_table, o.name_string_text,
227 o.objvar_0_name, o.objvar_0_type, o.objvar_0_value,
228 o.objvar_1_name, o.objvar_1_type, o.objvar_1_value,
229 o.objvar_2_name, o.objvar_2_type, o.objvar_2_value,
230 o.objvar_3_name, o.objvar_3_type, o.objvar_3_value,
231 o.objvar_4_name, o.objvar_4_type, o.objvar_4_value,
232 o.objvar_5_name, o.objvar_5_type, o.objvar_5_value,
233 o.objvar_6_name, o.objvar_6_type, o.objvar_6_value,
234 o.objvar_7_name, o.objvar_7_type, o.objvar_7_value,
235 o.objvar_8_name, o.objvar_8_type, o.objvar_8_value,
236 o.objvar_9_name, o.objvar_9_type, o.objvar_9_value,
237 o.objvar_10_name, o.objvar_10_type, o.objvar_10_value,
238 o.objvar_11_name, o.objvar_11_type, o.objvar_11_value,
239 o.objvar_12_name, o.objvar_12_type, o.objvar_12_value,
240 o.objvar_13_name, o.objvar_13_type, o.objvar_13_value,
241 o.objvar_14_name, o.objvar_14_type, o.objvar_14_value,
242 o.objvar_15_name, o.objvar_15_type, o.objvar_15_value,
243 o.objvar_16_name, o.objvar_16_type, o.objvar_16_value,
244 o.objvar_17_name, o.objvar_17_type, o.objvar_17_value,
245 o.objvar_18_name, o.objvar_18_type, o.objvar_18_value,
246 o.objvar_19_name, o.objvar_19_type, o.objvar_19_value,
249 where object_id between start_id and end_id
250 and object_template_id in (-448030425, 1838042928, 2082588198, 1741906969, 1120303977, -1207917085)
253 objVarRow objVarRowType;
254 cursor objVarCursor (start_id number, end_id number) is
258 nvl(n.name, to_char(n.id)),
261 from object_variables v, object_variable_names n
262 where v.object_id between start_id and end_id
263 and nvl(v.detached,0) = 0
265 order by v.object_id;
274 tempObjVar objVarType;
276 prefix varchar2(100);
278 dbms_output.put_line('start time = ' || to_char(sysdate, 'MM/DD/YY HH24:MI:SS'));
279 open objCursor (start_objectid, end_objectid);
280 fetch objCursor into objRow;
281 dbms_output.put_line('object cursor time = ' || to_char(sysdate, 'MM/DD/YY HH24:MI:SS'));
282 open objVarCursor (start_objectid, end_objectid);
283 fetch objVarCursor into objVarRow;
284 dbms_output.put_line('objvar cursor time = ' || to_char(sysdate, 'MM/DD/YY HH24:MI:SS'));
286 while objCursor%found loop
290 free_slots := numTable(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20);
293 Obj_ObjVars(i) := blankObjVar;
296 updated_objvars.trim(updated_objvars.count);
297 deleted_objvars.trim(deleted_objvars.count);
298 added_objvars.trim(added_objvars.count);
299 isObjModified := FALSE;
300 isSchematic := FALSE;
302 prefix := 'crafting_components.';
303 new_schematic_id := 0;
305 -- Load the data into variables
306 object_id := objRow.object_id;
307 script_list := objRow.scriptList;
308 object_name := objRow.object_name;
309 name_table := objRow.name_string_table;
310 name_text := objRow.name_string_text;
311 template_id := objRow.object_template_id;
312 new_template_id := template_id;
314 Obj_ObjVars(1).object_id := objRow.object_id; -- might be able to eliminate
315 Obj_ObjVars(1).objvar_name := objRow.objvar_0_name;
316 Obj_ObjVars(1).objvar_type := objRow.objvar_0_type;
317 Obj_ObjVars(1).objvar_value := objRow.objvar_0_value;
318 if ((objRow.objvar_0_name is not null) and (objRow.objvar_0_type != -1))then
319 slot_map(objRow.objvar_0_name) := 1;
320 free_slots.delete(1);
323 Obj_ObjVars(2).object_id := objRow.object_id;
324 Obj_ObjVars(2).objvar_name := objRow.objvar_1_name;
325 Obj_ObjVars(2).objvar_type := objRow.objvar_1_type;
326 Obj_ObjVars(2).objvar_value := objRow.objvar_1_value;
327 if ((objRow.objvar_1_name is not null) and (objRow.objvar_1_type != -1))then
328 slot_map(objRow.objvar_1_name) := 2;
329 free_slots.delete(2);
332 Obj_ObjVars(3).object_id := objRow.object_id;
333 Obj_ObjVars(3).objvar_name := objRow.objvar_2_name;
334 Obj_ObjVars(3).objvar_type := objRow.objvar_2_type;
335 Obj_ObjVars(3).objvar_value := objRow.objvar_2_value;
336 if ((objRow.objvar_2_name is not null) and (objRow.objvar_2_type != -1))then
337 slot_map(objRow.objvar_2_name) := 3;
338 free_slots.delete(3);
341 Obj_ObjVars(4).object_id := objRow.object_id;
342 Obj_ObjVars(4).objvar_name := objRow.objvar_3_name;
343 Obj_ObjVars(4).objvar_type := objRow.objvar_3_type;
344 Obj_ObjVars(4).objvar_value := objRow.objvar_3_value;
345 if ((objRow.objvar_3_name is not null) and (objRow.objvar_3_type != -1))then
346 slot_map(objRow.objvar_3_name) := 4;
347 free_slots.delete(4);
350 Obj_ObjVars(5).object_id := objRow.object_id;
351 Obj_ObjVars(5).objvar_name := objRow.objvar_4_name;
352 Obj_ObjVars(5).objvar_type := objRow.objvar_4_type;
353 Obj_ObjVars(5).objvar_value := objRow.objvar_4_value;
354 if ((objRow.objvar_4_name is not null) and (objRow.objvar_4_type != -1))then
355 slot_map(objRow.objvar_4_name) := 5;
356 free_slots.delete(5);
359 Obj_ObjVars(6).object_id := objRow.object_id;
360 Obj_ObjVars(6).objvar_name := objRow.objvar_5_name;
361 Obj_ObjVars(6).objvar_type := objRow.objvar_5_type;
362 Obj_ObjVars(6).objvar_value := objRow.objvar_5_value;
363 if ((objRow.objvar_5_name is not null) and (objRow.objvar_5_type != -1))then
364 slot_map(objRow.objvar_5_name) := 6;
365 free_slots.delete(6);
368 Obj_ObjVars(7).object_id := objRow.object_id;
369 Obj_ObjVars(7).objvar_name := objRow.objvar_6_name;
370 Obj_ObjVars(7).objvar_type := objRow.objvar_6_type;
371 Obj_ObjVars(7).objvar_value := objRow.objvar_6_value;
372 if ((objRow.objvar_6_name is not null) and (objRow.objvar_6_type != -1))then
373 slot_map(objRow.objvar_6_name) := 7;
374 free_slots.delete(7);
377 Obj_ObjVars(8).object_id := objRow.object_id;
378 Obj_ObjVars(8).objvar_name := objRow.objvar_7_name;
379 Obj_ObjVars(8).objvar_type := objRow.objvar_7_type;
380 Obj_ObjVars(8).objvar_value := objRow.objvar_7_value;
381 if ((objRow.objvar_7_name is not null) and (objRow.objvar_7_type != -1))then
382 slot_map(objRow.objvar_7_name) := 8;
383 free_slots.delete(8);
386 Obj_ObjVars(9).object_id := objRow.object_id;
387 Obj_ObjVars(9).objvar_name := objRow.objvar_8_name;
388 Obj_ObjVars(9).objvar_type := objRow.objvar_8_type;
389 Obj_ObjVars(9).objvar_value := objRow.objvar_8_value;
390 if ((objRow.objvar_8_name is not null) and (objRow.objvar_8_type != -1))then
391 slot_map(objRow.objvar_8_name) := 9;
392 free_slots.delete(9);
395 Obj_ObjVars(10).object_id := objRow.object_id;
396 Obj_ObjVars(10).objvar_name := objRow.objvar_9_name;
397 Obj_ObjVars(10).objvar_type := objRow.objvar_9_type;
398 Obj_ObjVars(10).objvar_value := objRow.objvar_9_value;
399 if ((objRow.objvar_9_name is not null) and (objRow.objvar_9_type != -1))then
400 slot_map(objRow.objvar_9_name) := 10;
401 free_slots.delete(10);
404 Obj_ObjVars(11).object_id := objRow.object_id;
405 Obj_ObjVars(11).objvar_name := objRow.objvar_10_name;
406 Obj_ObjVars(11).objvar_type := objRow.objvar_10_type;
407 Obj_ObjVars(11).objvar_value := objRow.objvar_10_value;
408 if ((objRow.objvar_10_name is not null) and (objRow.objvar_10_type != -1))then
409 slot_map(objRow.objvar_10_name) := 11;
410 free_slots.delete(11);
413 Obj_ObjVars(12).object_id := objRow.object_id;
414 Obj_ObjVars(12).objvar_name := objRow.objvar_11_name;
415 Obj_ObjVars(12).objvar_type := objRow.objvar_11_type;
416 Obj_ObjVars(12).objvar_value := objRow.objvar_11_value;
417 if ((objRow.objvar_11_name is not null) and (objRow.objvar_11_type != -1))then
418 slot_map(objRow.objvar_11_name) := 12;
419 free_slots.delete(12);
422 Obj_ObjVars(13).object_id := objRow.object_id;
423 Obj_ObjVars(13).objvar_name := objRow.objvar_12_name;
424 Obj_ObjVars(13).objvar_type := objRow.objvar_12_type;
425 Obj_ObjVars(13).objvar_value := objRow.objvar_12_value;
426 if ((objRow.objvar_12_name is not null) and (objRow.objvar_12_type != -1))then
427 slot_map(objRow.objvar_12_name) := 13;
428 free_slots.delete(13);
431 Obj_ObjVars(14).object_id := objRow.object_id;
432 Obj_ObjVars(14).objvar_name := objRow.objvar_13_name;
433 Obj_ObjVars(14).objvar_type := objRow.objvar_13_type;
434 Obj_ObjVars(14).objvar_value := objRow.objvar_13_value;
435 if ((objRow.objvar_13_name is not null) and (objRow.objvar_13_type != -1))then
436 slot_map(objRow.objvar_13_name) := 14;
437 free_slots.delete(14);
440 Obj_ObjVars(15).object_id := objRow.object_id;
441 Obj_ObjVars(15).objvar_name := objRow.objvar_14_name;
442 Obj_ObjVars(15).objvar_type := objRow.objvar_14_type;
443 Obj_ObjVars(15).objvar_value := objRow.objvar_14_value;
444 if ((objRow.objvar_14_name is not null) and (objRow.objvar_14_type != -1))then
445 slot_map(objRow.objvar_14_name) := 15;
446 free_slots.delete(15);
449 Obj_ObjVars(16).object_id := objRow.object_id;
450 Obj_ObjVars(16).objvar_name := objRow.objvar_15_name;
451 Obj_ObjVars(16).objvar_type := objRow.objvar_15_type;
452 Obj_ObjVars(16).objvar_value := objRow.objvar_15_value;
453 if ((objRow.objvar_15_name is not null) and (objRow.objvar_15_type != -1))then
454 slot_map(objRow.objvar_15_name) := 16;
455 free_slots.delete(16);
458 Obj_ObjVars(17).object_id := objRow.object_id;
459 Obj_ObjVars(17).objvar_name := objRow.objvar_16_name;
460 Obj_ObjVars(17).objvar_type := objRow.objvar_16_type;
461 Obj_ObjVars(17).objvar_value := objRow.objvar_16_value;
462 if ((objRow.objvar_16_name is not null) and (objRow.objvar_16_type != -1))then
463 slot_map(objRow.objvar_16_name) := 17;
464 free_slots.delete(17);
467 Obj_ObjVars(18).object_id := objRow.object_id;
468 Obj_ObjVars(18).objvar_name := objRow.objvar_17_name;
469 Obj_ObjVars(18).objvar_type := objRow.objvar_17_type;
470 Obj_ObjVars(18).objvar_value := objRow.objvar_17_value;
471 if ((objRow.objvar_17_name is not null) and (objRow.objvar_17_type != -1))then
472 slot_map(objRow.objvar_17_name) := 18;
473 free_slots.delete(18);
476 Obj_ObjVars(19).object_id := objRow.object_id;
477 Obj_ObjVars(19).objvar_name := objRow.objvar_18_name;
478 Obj_ObjVars(19).objvar_type := objRow.objvar_18_type;
479 Obj_ObjVars(19).objvar_value := objRow.objvar_18_value;
480 if ((objRow.objvar_18_name is not null) and (objRow.objvar_18_type != -1))then
481 slot_map(objRow.objvar_18_name) := 19;
482 free_slots.delete(19);
485 Obj_ObjVars(20).object_id := objRow.object_id;
486 Obj_ObjVars(20).objvar_name := objRow.objvar_19_name;
487 Obj_ObjVars(20).objvar_type := objRow.objvar_19_type;
488 Obj_ObjVars(20).objvar_value := objRow.objvar_19_value;
489 if ((objRow.objvar_19_name is not null) and (objRow.objvar_19_type != -1))then
490 slot_map(objRow.objvar_19_name) := 20;
491 free_slots.delete(20);
495 while (objVarCursor%found and objVarRow.object_id <= objRow.object_id) loop
496 if objVarRow.object_id = objRow.object_id then
497 tempObjVar := blankObjVar;
498 tempObjVar.object_id := objVarRow.object_id;
499 tempObjVar.objvar_name := objVarRow.objvar_name;
500 tempObjVar.objvar_type := objVarRow.objvar_type;
501 tempObjVar.objvar_value := objVarRow.objvar_value;
502 tempObjVar.objvar_name_id := objVarRow.objvar_name_id;
503 OV_ObjVars(objVarRow.objvar_name) := tempObjVar;
504 slot_map(objVarRow.objvar_name) := 21;
506 fetch objVarCursor into objVarRow;
509 -- check to see if it a weapon (162889564) or armor (1120303977) factory crate
510 -- or food (-200781577) or chemicals (-1966544754)
511 -- or electronics (-754298423) or clothing (-1207917085)
512 if template_id = 162889564 or template_id = 1120303977
513 or template_id = -200781577 or template_id = -1966544754
514 or template_id = -754298423 or template_id = -1207917085 then
515 if slot_map.exists('draftSchematic') then
516 if slot_map('draftSchematic') < 21 then
517 template_id := SchematicMap(to_number(Obj_ObjVars(slot_map('draftSchematic')).objvar_value));
519 template_id := SchematicMap(to_number(OV_ObjVars('draftSchematic').objvar_value));
522 prefix := 'crafting_attributes.crafting:';
523 DeleteObjVar('ingr.*');
527 -- Do the conversions
528 if template_id = -448030425 then
529 SetGpAndCond(prefix || 'general_protection', '0.3', prefix || 'condition', '0.2');
530 if isFactory = TRUE then
531 ModifyObjVar('draftSchematic','draftSchematic',0,1861772866);
532 AddScript('systems.crafting.armor.component.crafting_new_armor_segment');
534 SetNewTemplateId(1594162622); --object/tangible/component/armor/armor_segment_recon.iff
535 RemoveScript('systems.crafting.armor.component.crafting_armor_component_attribute');
536 RemoveScript('item.armor.new_armor'); -- to prevent two copies of same script
537 AddScript('item.armor.new_armor');
539 elsif template_id = 1838042928 then
540 RenameObjVar(prefix || 'armor_general_protection',prefix || 'general_protection');
541 RenameObjVar(prefix || 'armor_condition',prefix || 'condition');
542 if isFactory = FALSE then
543 SetNewTemplateId(-1438161694); --object/tangible/component/armor/armor_segment_battle.iff
545 elsif template_id = 2082588198 then
546 RenameObjVar(prefix || 'armor_general_protection',prefix || 'general_protection');
547 RenameObjVar(prefix || 'armor_condition',prefix || 'condition');
548 if isFactory = FALSE then
549 SetNewTemplateId(2042493214); --object/tangible/component/armor/armor_segment_assault.iff
551 elsif template_id = 1741906969 then
552 RenameObjVar(prefix || 'armor_general_protection',prefix || 'general_protection');
553 RenameObjVar(prefix || 'armor_condition',prefix || 'condition');
554 if isFactory = FALSE then
555 SetNewTemplateId(1594162622); --object/tangible/component/armor/armor_segment_recon.iff
559 if isObjModified = TRUE then
561 stmt := 'update objects set '
562 || 'objvar_0_name = :o0n, objvar_0_type = :o0t, objvar_0_value = :o0v, '
563 || 'objvar_1_name = :o1n, objvar_1_type = :o1t, objvar_1_value = :o1v, '
564 || 'objvar_2_name = :o2n, objvar_2_type = :o2t, objvar_2_value = :o2v, '
565 || 'objvar_3_name = :o3n, objvar_3_type = :o3t, objvar_3_value = :o3v, '
566 || 'objvar_4_name = :o4n, objvar_4_type = :o4t, objvar_4_value = :o4v, '
567 || 'objvar_5_name = :o5n, objvar_5_type = :o5t, objvar_5_value = :o5v, '
568 || 'objvar_6_name = :o6n, objvar_6_type = :o6t, objvar_6_value = :o6v, '
569 || 'objvar_7_name = :o7n, objvar_7_type = :o7t, objvar_7_value = :o7v, '
570 || 'objvar_8_name = :o8n, objvar_8_type = :o8t, objvar_8_value = :o8v, '
571 || 'objvar_9_name = :o9n, objvar_9_type = :o9t, objvar_9_value = :o9v, '
572 || 'objvar_10_name = :o10n, objvar_10_type = :o10t, objvar_10_value = :o10v, '
573 || 'objvar_11_name = :o11n, objvar_11_type = :o11t, objvar_11_value = :o11v, '
574 || 'objvar_12_name = :o12n, objvar_12_type = :o12t, objvar_12_value = :o12v, '
575 || 'objvar_13_name = :o13n, objvar_13_type = :o13t, objvar_13_value = :o13v, '
576 || 'objvar_14_name = :o14n, objvar_14_type = :o14t, objvar_14_value = :o14v, '
577 || 'objvar_15_name = :o15n, objvar_15_type = :o15t, objvar_15_value = :o15v, '
578 || 'objvar_16_name = :o16n, objvar_16_type = :o16t, objvar_16_value = :o16v, '
579 || 'objvar_17_name = :o17n, objvar_17_type = :o17t, objvar_17_value = :o17v, '
580 || 'objvar_18_name = :o18n, objvar_18_type = :o18t, objvar_18_value = :o18v, '
581 || 'objvar_19_name = :o19n, objvar_19_type = :o19t, objvar_19_value = :o19v, '
582 || 'script_list = :sl, object_template_id = :otid, '
583 || 'object_name = :obn, name_string_table = :nstb, name_string_text = :nstx, '
584 || 'conversion_id = :version '
585 || 'where object_id = :id';
587 execute immediate stmt using
588 Obj_ObjVars(1).objvar_name, Obj_ObjVars(1).objvar_type, Obj_ObjVars(1).objvar_value,
589 Obj_ObjVars(2).objvar_name, Obj_ObjVars(2).objvar_type, Obj_ObjVars(2).objvar_value,
590 Obj_ObjVars(3).objvar_name, Obj_ObjVars(3).objvar_type, Obj_ObjVars(3).objvar_value,
591 Obj_ObjVars(4).objvar_name, Obj_ObjVars(4).objvar_type, Obj_ObjVars(4).objvar_value,
592 Obj_ObjVars(5).objvar_name, Obj_ObjVars(5).objvar_type, Obj_ObjVars(5).objvar_value,
593 Obj_ObjVars(6).objvar_name, Obj_ObjVars(6).objvar_type, Obj_ObjVars(6).objvar_value,
594 Obj_ObjVars(7).objvar_name, Obj_ObjVars(7).objvar_type, Obj_ObjVars(7).objvar_value,
595 Obj_ObjVars(8).objvar_name, Obj_ObjVars(8).objvar_type, Obj_ObjVars(8).objvar_value,
596 Obj_ObjVars(9).objvar_name, Obj_ObjVars(9).objvar_type, Obj_ObjVars(9).objvar_value,
597 Obj_ObjVars(10).objvar_name, Obj_ObjVars(10).objvar_type, Obj_ObjVars(10).objvar_value,
598 Obj_ObjVars(11).objvar_name, Obj_ObjVars(11).objvar_type, Obj_ObjVars(11).objvar_value,
599 Obj_ObjVars(12).objvar_name, Obj_ObjVars(12).objvar_type, Obj_ObjVars(12).objvar_value,
600 Obj_ObjVars(13).objvar_name, Obj_ObjVars(13).objvar_type, Obj_ObjVars(13).objvar_value,
601 Obj_ObjVars(14).objvar_name, Obj_ObjVars(14).objvar_type, Obj_ObjVars(14).objvar_value,
602 Obj_ObjVars(15).objvar_name, Obj_ObjVars(15).objvar_type, Obj_ObjVars(15).objvar_value,
603 Obj_ObjVars(16).objvar_name, Obj_ObjVars(16).objvar_type, Obj_ObjVars(16).objvar_value,
604 Obj_ObjVars(17).objvar_name, Obj_ObjVars(17).objvar_type, Obj_ObjVars(17).objvar_value,
605 Obj_ObjVars(18).objvar_name, Obj_ObjVars(18).objvar_type, Obj_ObjVars(18).objvar_value,
606 Obj_ObjVars(19).objvar_name, Obj_ObjVars(19).objvar_type, Obj_ObjVars(19).objvar_value,
607 Obj_ObjVars(20).objvar_name, Obj_ObjVars(20).objvar_type, Obj_ObjVars(20).objvar_value,
608 script_list, new_template_id,
609 object_name, name_table, name_text,
615 dbms_output.put_line('Error in object update(' || object_id || ') - time = ' || to_char(sysdate, 'MM/DD/YY HH24:MI:SS'));
616 db_error_logger.dblogerror(err_num, 'Error in object update');
620 i := deleted_objvars.first;
621 while i is not null loop
623 stmt := 'delete from object_variables '
624 || 'where object_id = :id and name_id = :oldname';
626 execute immediate stmt using
628 OV_ObjVars(deleted_objvars(i)).old_objvar_name_id;
630 i := deleted_objvars.next(i);
634 dbms_output.put_line('Error (' || SQLERRM(err_num) || ') with deleted_objvars(' || object_id || ') - time = ' || to_char(sysdate, 'MM/DD/YY HH24:MI:SS'));
635 db_error_logger.dblogerror(err_num, 'Error with deleted_objvars');
636 i := deleted_objvars.next(i);
640 i := added_objvars.first;
641 while i is not null loop
643 stmt := 'insert into object_variables values '
644 || '(:id, :name, :type, :value, 0)';
646 execute immediate stmt using
648 OV_ObjVars(added_objvars(i)).objvar_name_id,
649 OV_ObjVars(added_objvars(i)).objvar_type,
650 OV_ObjVars(added_objvars(i)).objvar_value;
652 i := added_objvars.next(i);
656 dbms_output.put_line('Error (' || SQLERRM(err_num) || ') with added_objvars(' || object_id || ') - time = ' || to_char(sysdate, 'MM/DD/YY HH24:MI:SS'));
657 db_error_logger.dblogerror(err_num, 'Error with added_objvars');
658 i := added_objvars.next(i);
662 i := updated_objvars.first;
663 while i is not null loop
665 stmt := 'update object_variables set '
666 || 'name_id = :name, type = :type, value = :value '
667 || 'where object_id = :id and name_id = :oldname';
669 execute immediate stmt using
670 objvarNameIdMap(OV_ObjVars(updated_objvars(i)).objvar_name),
671 OV_ObjVars(updated_objvars(i)).objvar_type,
672 OV_ObjVars(updated_objvars(i)).objvar_value,
674 OV_ObjVars(updated_objvars(i)).old_objvar_name_id;
676 i := updated_objvars.next(i);
680 dbms_output.put_line('Error (' || SQLERRM(err_num) || ') with updated_objvars(' || object_id || ') - time = ' || to_char(sysdate, 'MM/DD/YY HH24:MI:SS'));
681 db_error_logger.dblogerror(err_num, 'Error with updated_objvars');
682 i := updated_objvars.next(i);
688 -- commit every 100,000 records
691 if use_rbs is not null then
692 execute immediate 'set transaction use rollback segment ' || use_rbs;
694 dbms_output.put_line('100,000 rows = ' || to_char(sysdate, 'MM/DD/YY HH24:MI:SS'));
699 fetch objCursor into objRow;
705 dbms_output.put_line('end time = ' || to_char(sysdate, 'MM/DD/YY HH24:MI:SS'));
706 dbms_output.put_line('converted = ' || to_char(cvt));
707 dbms_output.put_line('total count = ' || to_char(cnt));
711 dbms_output.put_line('Error (' || SQLERRM(err_num) || ') in DoItemConversionBatch (' || object_id || ') - time = ' || to_char(sysdate, 'MM/DD/YY HH24:MI:SS'));
712 db_error_logger.dblogerror(err_num, 'Error in DoItemConversionBatch');
715 function InitializeData return boolean
717 objvarNameIdRow object_variable_names%rowtype;
718 -- ALL added/updated objvar names MUST be in this list
719 cursor objvarNameIdCursor is
720 select id, name from object_variable_names
722 'armor.armorCategory',
724 'armor.armorencumbrance',
726 'armor.effectiveness',
728 'armor.encumbranceSplit',
729 'armor.general_protection',
734 'armor.mandDeconstruct',
736 'armor.recharge_rate',
737 'armor.risDeconstruct',
739 'armor.special.1024',
743 'armor.special.2048',
747 'armor.special.4096',
751 'armor.vulnerability',
754 'biolink.faction_points',
760 'crafting_attributes.crafting:accuracy',
761 'crafting_attributes.crafting:armor_condition',
762 'crafting_attributes.crafting:armor_general_protection',
763 'crafting_attributes.crafting:armor_layer0',
764 'crafting_attributes.crafting:armor_layer1',
765 'crafting_attributes.crafting:armor_layer2',
766 'crafting_attributes.crafting:armor_layer4',
767 'crafting_attributes.crafting:armor_layer5',
768 'crafting_attributes.crafting:armor_layer6',
769 'crafting_attributes.crafting:armor_layer7',
770 'crafting_attributes.crafting:armor_layer12',
771 'crafting_attributes.crafting:attackActionCost',
772 'crafting_attributes.crafting:attackCost',
773 'crafting_attributes.crafting:attackHealthCost',
774 'crafting_attributes.crafting:attackMindCost',
775 'crafting_attributes.crafting:attackSpeed',
776 'crafting_attributes.crafting:condition',
777 'crafting_attributes.crafting:damageType',
778 'crafting_attributes.crafting:effect',
779 'crafting_attributes.crafting:efficiency',
780 'crafting_attributes.crafting:elementalType',
781 'crafting_attributes.crafting:elementalValue',
782 'crafting_attributes.crafting:flavor',
783 'crafting_attributes.crafting:general_protection',
784 'crafting_attributes.crafting:hitPoints',
785 'crafting_attributes.crafting:maxDamage',
786 'crafting_attributes.crafting:maxRange',
787 'crafting_attributes.crafting:maxRangeMod',
788 'crafting_attributes.crafting:midRange',
789 'crafting_attributes.crafting:midRangeMod',
790 'crafting_attributes.crafting:minDamage',
791 'crafting_attributes.crafting:minRange',
792 'crafting_attributes.crafting:minRangeMod',
793 'crafting_attributes.crafting:nutrition',
794 'crafting_attributes.crafting:power',
795 'crafting_attributes.crafting:woundChance',
796 'crafting_attributes.crafting:zeroRangeMod',
797 'crafting_components.accuracy',
798 'crafting_components.armor_armorencumbrance',
799 'crafting_components.armor_condition',
800 'crafting_components.armor_general_protection',
801 'crafting_components.armor_layer0',
802 'crafting_components.armor_layer1',
803 'crafting_components.armor_layer2',
804 'crafting_components.armor_layer4',
805 'crafting_components.armor_layer5',
806 'crafting_components.armor_layer6',
807 'crafting_components.armor_layer7',
808 'crafting_components.armor_layer12',
809 'crafting_components.attackActionCost',
810 'crafting_components.attackCost',
811 'crafting_components.attackHealthCost',
812 'crafting_components.attackMindCost',
813 'crafting_components.attackSpeed',
814 'crafting_components.attribute.bonus.0',
815 'crafting_components.attribute.bonus.1',
816 'crafting_components.attribute.bonus.2',
817 'crafting_components.attribute.bonus.3',
818 'crafting_components.attribute.bonus.4',
819 'crafting_components.attribute.bonus.5',
820 'crafting_components.attribute.bonus.6',
821 'crafting_components.attribute.bonus.7',
822 'crafting_components.attribute.bonus.8',
823 'crafting_components.condition',
824 'crafting_components.damageType',
825 'crafting_components.elementalType',
826 'crafting_components.elementalValue',
827 'crafting_components.general_protection',
828 'crafting_components.hitPoints',
829 'crafting_components.layer13',
830 'crafting_components.layer14',
831 'crafting_components.layer15',
832 'crafting_components.maxDamage',
833 'crafting_components.maxRange',
834 'crafting_components.maxRangeMod',
835 'crafting_components.midRange',
836 'crafting_components.midRangeMod',
837 'crafting_components.minDamage',
838 'crafting_components.minRange',
839 'crafting_components.minRangeMod',
840 'crafting_components.recharge_rate',
841 'crafting_components.woundChance',
842 'crafting_components.zeroRangeMod',
848 'ImAnInvalidSchematic',
849 'intAOEDamagePercent',
851 'jedi.crystal.stats.accuracy',
852 'jedi.crystal.stats.attack_cost',
853 'jedi.crystal.stats.damage_type',
854 'jedi.crystal.stats.elemental_type',
855 'jedi.crystal.stats.elemental_value',
856 'jedi.crystal.stats.force',
857 'jedi.crystal.stats.max_dmg',
858 'jedi.crystal.stats.max_rng',
859 'jedi.crystal.stats.min_dmg',
860 'jedi.crystal.stats.min_rng',
861 'jedi.crystal.stats.speed',
862 'jedi.crystal.stats.wound',
863 'jedi.saber.base_stats.accuracy',
864 'jedi.saber.base_stats.attack_cost',
865 'jedi.saber.base_stats.damage_type',
866 'jedi.saber.base_stats.elemental_type',
867 'jedi.saber.base_stats.elemental_value',
868 'jedi.saber.base_stats.force',
869 'jedi.saber.base_stats.max_dmg',
870 'jedi.saber.base_stats.max_rng',
871 'jedi.saber.base_stats.min_dmg',
872 'jedi.saber.base_stats.min_rng',
873 'jedi.saber.base_stats.speed',
874 'jedi.saber.base_stats.wound',
878 'powerup.actionCost',
881 'powerup.efficiency',
886 'skillmod.bonus.pistol_speed',
891 'weapon.intNoCertRequired',
896 schematicRow schematic_templates%rowtype;
897 cursor schematicCursor is
898 select schematic_id, object_template_id
899 from schematic_templates;
905 free_slots := numTable(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20);
906 Obj_ObjVars := objectObjVarArray();
907 Obj_Objvars.extend(20);
908 updated_objvars := varcharTable();
909 deleted_objvars := varcharTable();
910 added_objvars := varcharTable();
912 objvarNameIdMap('armor.armorCategory') := 0;
913 objvarNameIdMap('armor.armorLevel') := 0;
914 objvarNameIdMap('armor.armorencumbrance') := 0;
915 objvarNameIdMap('armor.condition') := 0;
916 objvarNameIdMap('armor.effectiveness') := 0;
917 objvarNameIdMap('armor.encumbrance') := 0;
918 objvarNameIdMap('armor.encumbranceSplit') := 0;
919 objvarNameIdMap('armor.general_protection') := 0;
920 objvarNameIdMap('armor.layer0') := 0;
921 objvarNameIdMap('armor.layer14') := 0;
922 objvarNameIdMap('armor.layer13') := 0;
923 objvarNameIdMap('armor.layer15') := 0;
924 objvarNameIdMap('armor.mandDeconstruct') := 0;
925 objvarNameIdMap('armor.rating') := 0;
926 objvarNameIdMap('armor.recharge_rate') := 0;
927 objvarNameIdMap('armor.risDeconstruct') := 0;
928 objvarNameIdMap('armor.special.1') := 0;
929 objvarNameIdMap('armor.special.1024') := 0;
930 objvarNameIdMap('armor.special.128') := 0;
931 objvarNameIdMap('armor.special.16') := 0;
932 objvarNameIdMap('armor.special.2') := 0;
933 objvarNameIdMap('armor.special.2048') := 0;
934 objvarNameIdMap('armor.special.256') := 0;
935 objvarNameIdMap('armor.special.32') := 0;
936 objvarNameIdMap('armor.special.4') := 0;
937 objvarNameIdMap('armor.special.4096') := 0;
938 objvarNameIdMap('armor.special.512') := 0;
939 objvarNameIdMap('armor.special.64') := 0;
940 objvarNameIdMap('armor.special.8') := 0;
941 objvarNameIdMap('armor.vulnerability') := 0;
942 objvarNameIdMap('armorCategory') := 0;
943 objvarNameIdMap('armorLevel') := 0;
944 objvarNameIdMap('biolink.faction_points') := 0;
945 objvarNameIdMap('blindChance') := 0;
946 objvarNameIdMap('blindDuration') := 0;
947 objvarNameIdMap('buff_name') := 0;
948 objvarNameIdMap('burnDuration') := 0;
949 objvarNameIdMap('burnIntensity') := 0;
950 objvarNameIdMap('crafting_attributes.crafting:accuracy') := 0;
951 objvarNameIdMap('crafting_attributes.crafting:armor_general_protection') := 0;
952 objvarNameIdMap('crafting_attributes.crafting:armor_condition') := 0;
953 objvarNameIdMap('crafting_attributes.crafting:armor_layer0') := 0;
954 objvarNameIdMap('crafting_attributes.crafting:armor_layer1') := 0;
955 objvarNameIdMap('crafting_attributes.crafting:armor_layer2') := 0;
956 objvarNameIdMap('crafting_attributes.crafting:armor_layer4') := 0;
957 objvarNameIdMap('crafting_attributes.crafting:armor_layer5') := 0;
958 objvarNameIdMap('crafting_attributes.crafting:armor_layer6') := 0;
959 objvarNameIdMap('crafting_attributes.crafting:armor_layer7') := 0;
960 objvarNameIdMap('crafting_attributes.crafting:armor_layer12') := 0;
961 objvarNameIdMap('crafting_attributes.crafting:attackActionCost') := 0;
962 objvarNameIdMap('crafting_attributes.crafting:attackCost') := 0;
963 objvarNameIdMap('crafting_attributes.crafting:attackHealthCost') := 0;
964 objvarNameIdMap('crafting_attributes.crafting:attackMindCost') := 0;
965 objvarNameIdMap('crafting_attributes.crafting:attackSpeed') := 0;
966 objvarNameIdMap('crafting_attributes.crafting:condition') := 0;
967 objvarNameIdMap('crafting_attributes.crafting:damageType') := 0;
968 objvarNameIdMap('crafting_attributes.crafting:effect') := 0;
969 objvarNameIdMap('crafting_attributes.crafting:efficiency') := 0;
970 objvarNameIdMap('crafting_attributes.crafting:elementalType') := 0;
971 objvarNameIdMap('crafting_attributes.crafting:elementalValue') := 0;
972 objvarNameIdMap('crafting_attributes.crafting:flavor') := 0;
973 objvarNameIdMap('crafting_attributes.crafting:general_protection') := 0;
974 objvarNameIdMap('crafting_attributes.crafting:hitPoints') := 0;
975 objvarNameIdMap('crafting_attributes.crafting:maxDamage') := 0;
976 objvarNameIdMap('crafting_attributes.crafting:maxRange') := 0;
977 objvarNameIdMap('crafting_attributes.crafting:maxRangeMod') := 0;
978 objvarNameIdMap('crafting_attributes.crafting:midRange') := 0;
979 objvarNameIdMap('crafting_attributes.crafting:midRangeMod') := 0;
980 objvarNameIdMap('crafting_attributes.crafting:minDamage') := 0;
981 objvarNameIdMap('crafting_attributes.crafting:minRange') := 0;
982 objvarNameIdMap('crafting_attributes.crafting:minRangeMod') := 0;
983 objvarNameIdMap('crafting_attributes.crafting:nutrition') := 0;
984 objvarNameIdMap('crafting_attributes.crafting:power') := 0;
985 objvarNameIdMap('crafting_attributes.crafting:woundChance') := 0;
986 objvarNameIdMap('crafting_attributes.crafting:zeroRangeMod') := 0;
987 objvarNameIdMap('crafting_components.accuracy') := 0;
988 objvarNameIdMap('crafting_components.armor_armorencumbrance') := 0;
989 objvarNameIdMap('crafting_components.armor_condition') := 0;
990 objvarNameIdMap('crafting_components.armor_general_protection') := 0;
991 objvarNameIdMap('crafting_components.armor_layer0') := 0;
992 objvarNameIdMap('crafting_components.armor_layer1') := 0;
993 objvarNameIdMap('crafting_components.armor_layer2') := 0;
994 objvarNameIdMap('crafting_components.armor_layer4') := 0;
995 objvarNameIdMap('crafting_components.armor_layer5') := 0;
996 objvarNameIdMap('crafting_components.armor_layer6') := 0;
997 objvarNameIdMap('crafting_components.armor_layer7') := 0;
998 objvarNameIdMap('crafting_components.armor_layer12') := 0;
999 objvarNameIdMap('crafting_components.attackActionCost') := 0;
1000 objvarNameIdMap('crafting_components.attackCost') := 0;
1001 objvarNameIdMap('crafting_components.attackHealthCost') := 0;
1002 objvarNameIdMap('crafting_components.attackMindCost') := 0;
1003 objvarNameIdMap('crafting_components.attackSpeed') := 0;
1004 objvarNameIdMap('crafting_components.attribute.bonus.0') := 0;
1005 objvarNameIdMap('crafting_components.attribute.bonus.1') := 0;
1006 objvarNameIdMap('crafting_components.attribute.bonus.2') := 0;
1007 objvarNameIdMap('crafting_components.attribute.bonus.3') := 0;
1008 objvarNameIdMap('crafting_components.attribute.bonus.4') := 0;
1009 objvarNameIdMap('crafting_components.attribute.bonus.5') := 0;
1010 objvarNameIdMap('crafting_components.attribute.bonus.6') := 0;
1011 objvarNameIdMap('crafting_components.attribute.bonus.7') := 0;
1012 objvarNameIdMap('crafting_components.attribute.bonus.8') := 0;
1013 objvarNameIdMap('crafting_components.condition') := 0;
1014 objvarNameIdMap('crafting_components.damageType') := 0;
1015 objvarNameIdMap('crafting_components.elementalType') := 0;
1016 objvarNameIdMap('crafting_components.elementalValue') := 0;
1017 objvarNameIdMap('crafting_components.general_protection') := 0;
1018 objvarNameIdMap('crafting_components.hitPoints') := 0;
1019 objvarNameIdMap('crafting_components.layer13') := 0;
1020 objvarNameIdMap('crafting_components.layer14') := 0;
1021 objvarNameIdMap('crafting_components.layer15') := 0;
1022 objvarNameIdMap('crafting_components.maxDamage') := 0;
1023 objvarNameIdMap('crafting_components.maxRange') := 0;
1024 objvarNameIdMap('crafting_components.maxRangeMod') := 0;
1025 objvarNameIdMap('crafting_components.midRange') := 0;
1026 objvarNameIdMap('crafting_components.midRangeMod') := 0;
1027 objvarNameIdMap('crafting_components.minDamage') := 0;
1028 objvarNameIdMap('crafting_components.minRange') := 0;
1029 objvarNameIdMap('crafting_components.minRangeMod') := 0;
1030 objvarNameIdMap('crafting_components.recharge_rate') := 0;
1031 objvarNameIdMap('crafting_components.woundChance') := 0;
1032 objvarNameIdMap('crafting_components.zeroRangeMod') := 0;
1033 objvarNameIdMap('draftSchematic') := 0;
1034 objvarNameIdMap('duration') := 0;
1035 objvarNameIdMap('effect_class') := 0;
1036 objvarNameIdMap('effectiveness') := 0;
1037 objvarNameIdMap('filling') := 0;
1038 objvarNameIdMap('ImAnInvalidSchematic') := 0;
1039 objvarNameIdMap('intAOEDamagePercent') := 0;
1040 objvarNameIdMap('intWeaponType') := 0;
1041 objvarNameIdMap('jedi.crystal.stats.accuracy') := 0;
1042 objvarNameIdMap('jedi.crystal.stats.attack_cost') := 0;
1043 objvarNameIdMap('jedi.crystal.stats.damage_type') := 0;
1044 objvarNameIdMap('jedi.crystal.stats.elemental_type') := 0;
1045 objvarNameIdMap('jedi.crystal.stats.elemental_value') := 0;
1046 objvarNameIdMap('jedi.crystal.stats.force') := 0;
1047 objvarNameIdMap('jedi.crystal.stats.max_dmg') := 0;
1048 objvarNameIdMap('jedi.crystal.stats.max_rng') := 0;
1049 objvarNameIdMap('jedi.crystal.stats.min_dmg') := 0;
1050 objvarNameIdMap('jedi.crystal.stats.min_rng') := 0;
1051 objvarNameIdMap('jedi.crystal.stats.speed') := 0;
1052 objvarNameIdMap('jedi.crystal.stats.wound') := 0;
1053 objvarNameIdMap('jedi.saber.base_stats.accuracy') := 0;
1054 objvarNameIdMap('jedi.saber.base_stats.attack_cost') := 0;
1055 objvarNameIdMap('jedi.saber.base_stats.damage_type') := 0;
1056 objvarNameIdMap('jedi.saber.base_stats.elemental_type') := 0;
1057 objvarNameIdMap('jedi.saber.base_stats.elemental_value') := 0;
1058 objvarNameIdMap('jedi.saber.base_stats.force') := 0;
1059 objvarNameIdMap('jedi.saber.base_stats.max_dmg') := 0;
1060 objvarNameIdMap('jedi.saber.base_stats.max_rng') := 0;
1061 objvarNameIdMap('jedi.saber.base_stats.min_dmg') := 0;
1062 objvarNameIdMap('jedi.saber.base_stats.min_rng') := 0;
1063 objvarNameIdMap('jedi.saber.base_stats.speed') := 0;
1064 objvarNameIdMap('jedi.saber.base_stats.wound') := 0;
1065 objvarNameIdMap('jedi.saber.force') := 0;
1066 objvarNameIdMap('healing.power') := 0;
1067 objvarNameIdMap('powerup.accuracy') := 0;
1068 objvarNameIdMap('powerup.actionCost') := 0;
1069 objvarNameIdMap('powerup.damage') := 0;
1070 objvarNameIdMap('powerup.effect') := 0;
1071 objvarNameIdMap('powerup.efficiency') := 0;
1072 objvarNameIdMap('powerup.speed') := 0;
1073 objvarNameIdMap('powerup.usesLeft') := 0;
1074 objvarNameIdMap('powerup.wound') := 0;
1075 objvarNameIdMap('reuseTimer') := 0;
1076 objvarNameIdMap('skillmod.bonus.pistol_speed') := 0;
1077 objvarNameIdMap('slowDuration') := 0;
1078 objvarNameIdMap('slowIntensity') := 0;
1079 objvarNameIdMap('spice.name') := 0;
1080 objvarNameIdMap('strWeaponType') := 0;
1081 objvarNameIdMap('weapon.intNoCertRequired') := 0;
1082 objvarNameIdMap('weaponType') := 0;
1084 open objvarNameIdCursor;
1085 fetch objvarNameIdCursor into objvarNameIdRow;
1086 while objvarNameIdCursor%found loop
1087 objvarNameIdMap(objvarNameIdRow.name) := objvarNameIdRow.id;
1088 fetch objvarNameIdCursor into objvarNameIdRow;
1090 close objvarNameIdCursor;
1092 select max(id) into maxNameId from object_variable_names;
1094 v := objvarNameIdMap.first;
1095 while v is not null loop
1096 if objvarNameIdMap(v) = 0 then
1097 maxNameId := maxNameId + 1;
1098 stmt := 'insert into object_variable_names values (:id, :name)';
1099 execute immediate stmt using maxNameId, v;
1100 objvarNameIdMap(v) := maxNameId;
1102 v := objvarNameIdMap.next(v);
1105 if use_rbs is not null then
1106 execute immediate 'set transaction use rollback segment ' || use_rbs;
1109 open schematicCursor;
1110 fetch schematicCursor into schematicRow;
1111 while schematicCursor%found loop
1112 schematic_map(schematicRow.schematic_id) := schematicRow.object_template_id;
1113 fetch schematicCursor into schematicRow;
1115 close schematicCursor;
1118 templateNameText(1594162622) := 'armor_recon_segment';
1119 templateNameTable(1594162622) := 'craft_armor_ingredients_n';
1120 templateNameText(-1438161694) := 'armor_battle_segment';
1121 templateNameTable(-1438161694):= 'craft_armor_ingredients_n';
1122 templateNameText(2042493214) := 'armor_assault_segment';
1123 templateNameTable(2042493214) := 'craft_armor_ingredients_n';
1129 dbms_output.put_line('Error in InitializeData - time = ' || to_char(sysdate, 'MM/DD/YY HH24:MI:SS'));
1130 db_error_logger.dblogerror(err_num, 'Error in InitializeData');
1134 procedure AddObjVar (objvar_name varchar2, objvar_type number, objvar_value varchar2)
1137 tempObjVar objVarType;
1138 oldName varchar2(500);
1140 if slot_map.exists(objvar_name) then
1141 ModifyObjVar(objvar_name, objvar_name, objvar_type, objvar_value);
1143 if free_slots.count > 0 and length(objvar_name) <= 50 then
1144 n := free_slots(free_slots.first);
1145 Obj_ObjVars(n).objvar_name := objvar_name;
1146 Obj_ObjVars(n).objvar_type := objvar_type;
1147 Obj_ObjVars(n).objvar_value := objvar_value;
1148 free_slots.delete(n);
1149 isObjModified := TRUE;
1151 if deleted_objvars.count > 0 then
1152 oldName := deleted_objvars(deleted_objvars.last);
1153 deleted_objvars.trim(1);
1154 OV_ObjVars(oldName).objvar_name := objvar_name;
1155 OV_ObjVars(oldName).objvar_type := objvar_type;
1156 OV_ObjVars(oldName).objvar_value := objvar_value;
1157 updated_objvars.extend(1);
1158 updated_objvars(updated_objvars.last) := oldName;
1160 tempObjVar.object_id := object_id;
1161 tempObjVar.objvar_name := objvar_name;
1162 tempObjVar.objvar_type := objvar_type;
1163 tempObjVar.objvar_value := objvar_value;
1164 tempObjVar.objvar_name_id := objvarNameIdMap(objvar_name);
1165 OV_ObjVars(objvar_name) := tempObjVar;
1166 added_objvars.extend(1);
1167 added_objvars(added_objvars.last) := objvar_name;
1174 dbms_output.put_line('Error in AddObjVar - time = ' || to_char(sysdate, 'MM/DD/YY HH24:MI:SS'));
1175 db_error_logger.dblogerror(err_num, 'Error in AddObjVar');
1178 procedure DeleteObjVar (objVarName in varchar2)
1183 if slot_map.exists(objVarName) then
1184 if slot_map(objVarName) < 21 then
1185 n := slot_map(objVarName);
1186 if Obj_ObjVars(n).objvar_name = objVarName then
1187 Obj_ObjVars(n).objvar_name := NULL;
1188 Obj_ObjVars(n).objvar_type := NULL;
1189 Obj_ObjVars(n).objvar_value := NULL;
1191 isObjModified := TRUE;
1194 if OV_ObjVars(objVarName).objvar_name = objVarName then
1195 OV_ObjVars(objVarName).old_objvar_name_id := OV_ObjVars(objVarName).objvar_name_id;
1196 OV_ObjVars(objVarName).objvar_name := NULL;
1197 OV_ObjVars(objVarName).objvar_type := NULL;
1198 OV_ObjVars(objVarName).objvar_value := NULL;
1199 deleted_objvars.extend(1);
1200 deleted_objvars(deleted_objvars.last) := objVarName;
1203 elsif instr(objVarName,'*') > 0 then
1204 n := instr(objVarName,'*') -1;
1205 v := slot_map.first;
1206 while v is not null loop
1207 if substr(v,1,n) = substr(objVarName,1,n) then
1210 v := slot_map.next(v);
1216 dbms_output.put_line('Error in DeleteObjVar - time = ' || to_char(sysdate, 'MM/DD/YY HH24:MI:SS'));
1217 db_error_logger.dblogerror(err_num, 'Error in DeleteObjVar');
1220 procedure ModifyObjVar (oldObjVarName varchar2, objvar_name varchar2, objvar_type number, objvar_value varchar2)
1224 if slot_map.exists(oldObjVarName) then
1225 if slot_map(oldObjVarName) < 21 then
1226 n := slot_map(oldObjVarName);
1227 Obj_ObjVars(n).objvar_name := objvar_name;
1228 Obj_ObjVars(n).objvar_type := objvar_type;
1229 Obj_ObjVars(n).objvar_value := objvar_value;
1230 isObjModified := TRUE;
1232 OV_ObjVars(oldObjVarName).old_objvar_name_id := OV_ObjVars(oldObjVarName).objvar_name_id;
1233 OV_ObjVars(oldObjVarName).objvar_name := objvar_name;
1234 OV_ObjVars(oldObjVarName).objvar_type := objvar_type;
1235 OV_ObjVars(oldObjVarName).objvar_value := objvar_value;
1236 updated_objvars.extend(1);
1237 updated_objvars(updated_objvars.last) := oldObjVarName;
1243 dbms_output.put_line('Error in ModifyObjVar - time = ' || to_char(sysdate, 'MM/DD/YY HH24:MI:SS'));
1244 db_error_logger.dblogerror(err_num, 'Error in ModifyObjVar');
1247 procedure ModifyObjVar (oldObjVarName varchar2, objvar_name varchar2, objvar_type number, rangeTable rangeTableType)
1251 if slot_map.exists(oldObjVarName) then
1252 if slot_map(oldObjVarName) < 21 then
1253 n := slot_map(oldObjVarName);
1254 Obj_ObjVars(n).objvar_name := objvar_name;
1255 Obj_ObjVars(n).objvar_type := objvar_type;
1256 Obj_ObjVars(n).objvar_value := ConvertValue (to_number(Obj_ObjVars(n).objvar_value), rangeTable);
1257 isObjModified := TRUE;
1259 if OV_ObjVars(oldObjVarName).old_objvar_name_id = 0 then
1260 OV_ObjVars(oldObjVarName).old_objvar_name_id := OV_ObjVars(oldObjVarName).objvar_name_id;
1262 OV_ObjVars(oldObjVarName).objvar_name := objvar_name;
1263 OV_ObjVars(oldObjVarName).objvar_type := objvar_type;
1264 OV_ObjVars(oldObjVarName).objvar_value := ConvertValue (to_number(OV_ObjVars(oldObjVarName).objvar_value), rangeTable);
1265 updated_objvars.extend(1);
1266 updated_objvars(updated_objvars.last) := oldObjVarName;
1272 dbms_output.put_line('Error in ModifyObjVar - time = ' || to_char(sysdate, 'MM/DD/YY HH24:MI:SS'));
1273 db_error_logger.dblogerror(err_num, 'Error in ModifyObjVar');
1276 procedure RenameObjVar (oldObjVarName varchar2, objvar_name varchar2)
1280 if slot_map.exists(oldObjVarName) then
1281 if slot_map(oldObjVarName) < 21 then
1282 n := slot_map(oldObjVarName);
1283 Obj_ObjVars(n).objvar_name := objvar_name;
1284 isObjModified := TRUE;
1286 OV_ObjVars(oldObjVarName).old_objvar_name_id := OV_ObjVars(oldObjVarName).objvar_name_id;
1287 OV_ObjVars(oldObjVarName).objvar_name := objvar_name;
1288 updated_objvars.extend(1);
1289 updated_objvars(updated_objvars.last) := oldObjVarName;
1295 dbms_output.put_line('Error in ModifyObjVar - time = ' || to_char(sysdate, 'MM/DD/YY HH24:MI:SS'));
1296 db_error_logger.dblogerror(err_num, 'Error in ModifyObjVar');
1299 function GetObjVarValue (objvar_name varchar2) return varchar2
1302 if slot_map.exists(objvar_name) then
1303 if slot_map(objvar_name) < 21 then
1304 return Obj_ObjVars(slot_map(objvar_name)).objvar_value;
1306 return OV_ObjVars(objvar_name).objvar_value;
1313 procedure AddScript (newScript varchar2)
1316 script_list := trim(script_list) || newScript || ':';
1317 isObjModified := TRUE;
1320 procedure RemoveScript (oldScript varchar2)
1323 script_list := replace(script_list, oldScript || ':');
1324 isObjModified := TRUE;
1327 procedure SetNewTemplateId (newTemplateId number)
1330 new_template_id := newTemplateId;
1331 SetTemplateText (newTemplateId);
1334 procedure SetTemplateText (newTemplateId number)
1337 if templateNameText.exists(newTemplateId) then
1338 object_name := null;
1339 name_text := templateNameText(newTemplateId);
1340 if templateNameTable.exists(newTemplateId) then
1341 name_table := templateNameTable(newTemplateId);
1346 procedure InvalidateSchematic
1349 AddObjVar('ImAnInvalidSchematic',0,1);
1350 isObjModified := TRUE;
1353 procedure SetGenProtection(rangeTable rangeTableType)
1356 if isFactory= TRUE then
1357 ModifyObjVar('crafting_attributes.crafting:armor_effectiveness','crafting_attributes.crafting:general_protection',2,rangeTable);
1359 ModifyObjVar('armor.effectiveness','armor.general_protection',2,rangeTable);
1363 procedure SetArmorCondLevelCat(condition varchar2, lev varchar2, category varchar2)
1366 if isFactory= TRUE then
1367 AddObjVar('crafting_attributes.crafting:condition',2,condition);
1368 AddObjVar('armorLevel',0,lev);
1369 AddObjVar('armorCategory',0,category);
1371 AddObjVar('armor.condition',2,condition);
1372 AddObjVar('armor.armorLevel',0,lev);
1373 AddObjVar('armor.armorCategory',0,category);
1377 procedure SetArmorLevel(lev varchar)
1380 if isFactory= TRUE then
1381 AddObjVar('armorLevel',0,lev);
1383 AddObjVar('armor.armorLevel',0,lev);
1387 procedure SetArmorCategory(category varchar2)
1390 if isFactory= TRUE then
1391 AddObjVar('armorCategory',0,category);
1393 AddObjVar('armor.armorCategory',0,category);
1397 procedure SetGpAndCond(gp_name varchar2, gp_val varchar2, cond_name varchar2, cond_val varchar2)
1400 AddObjVar(gp_name,2,gp_val);
1401 AddObjVar(cond_name,2,cond_val);
1404 procedure DeleteCraftingComponents
1407 DeleteObjVar('crafting_components.*');
1408 DeleteObjVar('item_attrib_keys');
1409 DeleteObjVar('item_attrib_values');
1412 function ConvertValue (oldvalue number, rangeTable rangeTableType)
1418 retval := rangeTable(rangeTable.first)(3); -- default to min value
1419 if oldvalue >= rangeTable(rangeTable.last)(2) then
1420 retval := rangeTable(rangeTable.last)(4);
1422 i := rangeTable.first;
1423 while i is not null loop
1424 if oldvalue >= rangeTable(i)(1) and oldvalue < rangeTable(i)(2) then
1425 retval := (( (oldvalue - rangeTable(i)(1)) *
1426 ((rangeTable(i)(4)-rangeTable(i)(3))/(rangeTable(i)(2)-rangeTable(i)(1))) )
1427 + rangeTable(i)(3) );
1430 i := rangeTable.next(i);
1437 function SchematicMap(schematic_id number)
1442 if schematic_map.exists(schematic_id) then
1443 retval := schematic_map(schematic_id);