Skip to content
This repository was archived by the owner on Jun 9, 2022. It is now read-only.

Commit f92e361

Browse files
committed
Implement basic creature_template_movement closes #67
1 parent be53283 commit f92e361

File tree

8 files changed

+61
-630
lines changed

8 files changed

+61
-630
lines changed

CREATELANG/Default.lng

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,7 @@ TEXT155=AreaTrigger
306306
TEXT156=LootCondition
307307
TEXT157=The error has accured while loading Creature EventAI:
308308
TEXT158=Please specify a source type!
309+
TEXT159=The error has accured while loading Creature Template Movement
309310

310311
[MAIN]
311312
Caption=Truice
@@ -910,7 +911,7 @@ btScriptNPCgossip=Show NPC gossip script
910911
gbNPCText=NPC text
911912
btShowNPCtextScript=Show NPC text script
912913
edcxID=ID
913-
tsCreatureMovement=Creature Movement
914+
tsCreatureTemplateMovement=Creature Movement
914915
lbHintCreatureMovement=First, select creature from Creature Location tab!
915916
lbcmemote=emote
916917
btShowCreatureMovementScript=Show Creature Movement Script

CREATELANG/zzaCustom.lng

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,4 +157,5 @@ TEXT155=AreaTrigger
157157
TEXT156=LootCondition
158158
TEXT157=The error has accured while loading Creature EventAI:
159159
TEXT158=Please specify a source type!
160+
TEXT159=The error has accured while loading Creature Template Movement:
160161

CREATELANG/zzzMainForm.lng

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -601,7 +601,7 @@ btScriptNPCgossip=Show NPC gossip script
601601
gbNPCText=NPC text
602602
btShowNPCtextScript=Show NPC text script
603603
edcxID=ID
604-
tsCreatureMovement=Creature Movement
604+
tsCreatureTemplateMovement=Creature Movement
605605
lbHintCreatureMovement=First, select creature from Creature Location tab!
606606
lbcmemote=emote
607607
btShowCreatureMovementScript=Show Creature Movement Script

LANG/Czech.lng

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -871,7 +871,7 @@ btScriptNPCgossip=Uk
871871
gbNPCText=NPC text
872872
btShowNPCtextScript=Uk�zat NPC text script
873873
edcxID=ID
874-
tsCreatureMovement=Creature Movement
874+
tsCreatureTemplateMovement=Creature Movement
875875
lbHintCreatureMovement=First, select creature from Creature Location tab!
876876
lbcmemote=emote
877877
btShowCreatureMovementScript=Uk�zat Creature Movement Script

LANG/Default.lng

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -910,7 +910,7 @@ btScriptNPCgossip=Show NPC gossip script
910910
gbNPCText=NPC text
911911
btShowNPCtextScript=Show NPC text script
912912
edcxID=ID
913-
tsCreatureMovement=Creature Movement
913+
tsCreatureTemplateMovement=Creature Movement
914914
lbHintCreatureMovement=First, select creature from Creature Location tab!
915915
lbcmemote=emote
916916
btShowCreatureMovementScript=Show Creature Movement Script

MainUnit.dfm

Lines changed: 19 additions & 460 deletions
Large diffs are not rendered by default.

MainUnit.pas

Lines changed: 35 additions & 166 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ interface
4444
PFX_CREATURE_TEMPLATE_ADDON = 'cd';
4545
PFX_CREATURE_EQUIP_TEMPLATE = 'ce';
4646
PFX_CREATURE_MODEL_INFO = 'ci';
47-
PFX_CREATURE_MOVEMENT = 'cm';
47+
PFX_CREATURE_TEMPLATE_MOVEMENT = 'cm';
4848
PFX_CREATURE_LOOT_TEMPLATE = 'co';
4949
PFX_CREATURE_SMARTAI = 'cy';
5050
PFX_CONDITIONS = 'c';
@@ -1079,31 +1079,14 @@ TMainForm = class(TForm)
10791079
tsItemRewardFrom: TTabSheet;
10801080
lvItemProvidedFor: TJvListView;
10811081
lvItemRewardFrom: TJvListView;
1082-
tsCreatureMovement: TTabSheet;
1083-
lvcmMovement: TJvListView;
1084-
lbHintCreatureMovement: TLabel;
1082+
tsCreatureTemplateMovement: TTabSheet;
10851083
btShowCreatureMovementScript: TButton;
10861084
btFullCreatureMovementScript: TButton;
1087-
btCreatureMvmntAdd: TSpeedButton;
1088-
btCreatureMvmntUpd: TSpeedButton;
1089-
btCreatureMvmntDel: TSpeedButton;
1090-
edcmid: TLabeledEdit;
1091-
edcmpoint: TLabeledEdit;
1092-
edcmposition_x: TLabeledEdit;
1093-
edcmposition_y: TLabeledEdit;
1094-
edcmposition_z: TLabeledEdit;
1095-
edcmwaittime: TLabeledEdit;
1096-
edcmtextid1: TLabeledEdit;
1097-
edcmtextid2: TLabeledEdit;
1098-
edcmtextid3: TLabeledEdit;
1099-
edcmtextid4: TLabeledEdit;
1100-
edcmtextid5: TLabeledEdit;
1101-
edcmemote: TJvComboEdit;
1102-
edcmspell: TLabeledEdit;
1103-
edcmwpguid: TLabeledEdit;
1104-
edcmmodel1: TLabeledEdit;
1105-
edcmorientation: TLabeledEdit;
1106-
edcmmodel2: TLabeledEdit;
1085+
edcmcreatureid: TLabeledEdit;
1086+
edcmground: TLabeledEdit;
1087+
edcmswim: TLabeledEdit;
1088+
edcmflight: TLabeledEdit;
1089+
edcmrooted: TLabeledEdit;
11071090
lbqtDetailsEmote1: TLabel;
11081091
lbqtDetailsEmote2: TLabel;
11091092
lbqtDetailsEmote3: TLabel;
@@ -1115,7 +1098,6 @@ TMainForm = class(TForm)
11151098
lbqtOfferRewardEmote3: TLabel;
11161099
lbqtOfferRewardEmote4: TLabel;
11171100
lbcaemote: TLabel;
1118-
lbcmemote: TLabel;
11191101
edclequipment_id: TLabeledEdit;
11201102
edclmodelid: TLabeledEdit;
11211103
tsCreatureModelInfo: TTabSheet;
@@ -1898,11 +1880,6 @@ TMainForm = class(TForm)
18981880
procedure tsGOInvolvedInShow(Sender: TObject);
18991881
procedure tsItemInvolvedInShow(Sender: TObject);
19001882
procedure lvcoCreatureLootDblClick(Sender: TObject);
1901-
procedure lvcmMovementChange(Sender: TObject; Item: TListItem; Change: TItemChange);
1902-
procedure btCreatureMvmntAddClick(Sender: TObject);
1903-
procedure btCreatureMvmntUpdClick(Sender: TObject);
1904-
procedure btCreatureMvmntDelClick(Sender: TObject);
1905-
procedure lvcmMovementSelectItem(Sender: TObject; Item: TListItem; Selected: Boolean);
19061883
procedure btFullCreatureMovementScriptClick(Sender: TObject);
19071884
procedure tsCreatureEquipTemplateShow(Sender: TObject);
19081885
procedure tsCreatureModelInfoShow(Sender: TObject);
@@ -2075,6 +2052,7 @@ TMainForm = class(TForm)
20752052

20762053
procedure LoadCreature(Entry: integer);
20772054
procedure LoadCreatureTemplateAddon(entry: integer);
2055+
procedure LoadCreatureTemplateMovement(creatureid: integer);
20782056
procedure LoadCreatureAddon(GUID: integer);
20792057
procedure LoadCreatureEquip(entry: integer);
20802058
procedure LoadCreatureOnKillReputation(id: string);
@@ -2093,7 +2071,7 @@ TMainForm = class(TForm)
20932071
procedure CompleteNPCVendorScript;
20942072
procedure CompleteCreatureTemplateAddonScript;
20952073
procedure CompleteCreatureAddonScript;
2096-
procedure CompleteCreatureMovementScript;
2074+
procedure CompleteCreatureTemplateMovementScript;
20972075
procedure CompleteCreatureOnKillReputationScript;
20982076

20992077
{gameobjects}
@@ -2128,12 +2106,6 @@ TMainForm = class(TForm)
21282106
procedure SetLootEditFields(pfx: string; lvList: TJvListView);
21292107
procedure ShowFullLootScript(TableName: string; lvList: TJvListView; Memo: TMemo; entry: string);
21302108

2131-
{movement}
2132-
procedure MvmntAdd(pfx: string; lvList: TJvListView);
2133-
procedure MvmntUpd(pfx: string; lvList: TJvListView);
2134-
procedure MvmntDel(lvList: TJvListView);
2135-
procedure SetMvmntEditFields(pfx: string; lvList: TJvListView);
2136-
21372109
procedure EnchAdd(pfx: string; lvList: TJvListView);
21382110
procedure EnchDel(lvList: TJvListView);
21392111
procedure EnchUpd(pfx: string; lvList: TJvListView);
@@ -2509,7 +2481,7 @@ procedure TMainForm.FormCreate(Sender: TObject);
25092481

25102482
tsNPCVendor.TabVisible := false;
25112483
tsNPCTrainer.TabVisible := false;
2512-
tsCreatureMovement.TabVisible := false; //deactivate creature_movement tab
2484+
tsCreatureTemplateMovement.TabVisible := true;
25132485

25142486
ItemColors[0] := $9D9D9D;
25152487
ItemColors[1] := $000000;
@@ -4406,6 +4378,7 @@ procedure TMainForm.LoadCreature(Entry: integer);
44064378
tsNPCVendor.TabVisible := isvendor;
44074379
tsNPCTrainer.TabVisible := istrainer;
44084380
LoadCreatureTemplateAddon(Entry);
4381+
LoadCreatureTemplateMovement(Entry);
44094382
edclid.Text := IntToStr(Entry);
44104383
edcoEntry.Text := edctlootid.Text;
44114384
edcpEntry.Text := edctpickpocketloot.Text;
@@ -4649,7 +4622,7 @@ procedure TMainForm.tsCreatureScriptShow(Sender: TObject);
46494622
9: CompleteNPCTrainerScript;
46504623
10: CompleteCreatureTemplateAddonScript;
46514624
11: CompleteCreatureAddonScript;
4652-
13: CompleteCreatureMovementScript;
4625+
13: CompleteCreatureTemplateMovementScript;
46534626
14: CompleteCreatureOnKillReputationScript;
46544627
15: {involved in tab - do nothing};
46554628
end;
@@ -5420,19 +5393,6 @@ procedure TMainForm.lvclCreatureLocationSelectItem(Sender: TObject;
54205393
end;
54215394
end;
54225395

5423-
procedure TMainForm.lvcmMovementChange(Sender: TObject; Item: TListItem; Change: TItemChange);
5424-
begin
5425-
btCreatureMvmntUpd.Enabled := Assigned(TJvListView(Sender).Selected);
5426-
btCreatureMvmntDel.Enabled := Assigned(TJvListView(Sender).Selected);
5427-
end;
5428-
5429-
procedure TMainForm.lvcmMovementSelectItem(Sender: TObject; Item: TListItem; Selected: Boolean);
5430-
begin
5431-
if Selected then
5432-
SetMvmntEditFields('edcm', lvcmMovement);
5433-
end;
5434-
5435-
54365396
procedure TMainForm.lvcySmartAISelectItem(Sender: TObject; Item: TListItem; Selected: Boolean);
54375397
begin
54385398
if Selected then
@@ -5553,6 +5513,20 @@ procedure TMainForm.LoadCreatureTemplateAddon(entry: integer);
55535513
end;
55545514
end;
55555515

5516+
procedure TMainForm.LoadCreatureTemplateMovement(creatureid: integer);
5517+
begin
5518+
if creatureid<1 then Exit;
5519+
MyQuery.SQL.Text := Format('SELECT * FROM `creature_template_movement` WHERE (`CreatureId`=%d)',[creatureid]);
5520+
MyQuery.Open;
5521+
try
5522+
FillFields(MyQuery, PFX_CREATURE_TEMPLATE_MOVEMENT);
5523+
MyQuery.Close;
5524+
except
5525+
on E: Exception do
5526+
raise Exception.Create(dmMain.Text[159]+#10#13+E.Message);
5527+
end;
5528+
end;
5529+
55565530
procedure TMainForm.LoadCreatureAddon(GUID: integer);
55575531
begin
55585532
if GUID<1 then Exit;
@@ -5698,20 +5672,16 @@ procedure TMainForm.CompleteCreatureModelInfoScript;
56985672
'INSERT INTO `creature_model_info` (%s) VALUES (%s);'#13#10,[caguid, Fields, Values]);
56995673
end;
57005674

5701-
procedure TMainForm.CompleteCreatureMovementScript;
5702-
{
5675+
procedure TMainForm.CompleteCreatureTemplateMovementScript;
57035676
var
5704-
caguid,cmpoint, Fields, Values: string;
5705-
}
5677+
creatureid, Fields, Values: string;
57065678
begin
5707-
{mectLog.Clear;
5708-
caguid := trim( edcmid.Text );
5709-
cmpoint := trim( edcmpoint.Text );
5710-
if (caguid='') or (cmpoint='') then exit;
5711-
SetFieldsAndValues(Fields, Values, 'creature_movement', PFX_CREATURE_MOVEMENT, mectLog);
5712-
mectScript.Text := Format('DELETE FROM `creature_movement` WHERE (`id`=%s) AND (`point`=%s);'#13#10+
5713-
'INSERT INTO `creature_movement` (%s) VALUES (%s);'#13#10,[caguid, cmpoint, Fields, Values]); }
5714-
//disable creature_movement
5679+
mectLog.Clear;
5680+
creatureid := trim(edcmcreatureid.Text);
5681+
if creatureid='' then exit;
5682+
SetFieldsAndValues(Fields, Values, 'creature_template_movement', PFX_CREATURE_TEMPLATE_MOVEMENT, mectLog);
5683+
mectScript.Text := Format('DELETE FROM `creature_template_movement` WHERE (`creatureid`=%s);'#13#10+
5684+
'INSERT INTO `creature_template_movement` (%s) VALUES (%s);'#13#10,[creatureid, Fields, Values]);
57155685
end;
57165686

57175687
procedure TMainForm.CompleteCreatureOnKillReputationScript;
@@ -7122,36 +7092,6 @@ function TMainForm.MakeUpdateLocales(tn: string; pfx: string; KeyName: string; K
71227092
MyTempQuery.Close;
71237093
end;
71247094

7125-
7126-
procedure TMainForm.MvmntAdd(pfx: string; lvList: TJvListView);
7127-
begin
7128-
with lvList.Items.Add do
7129-
begin
7130-
Caption := TCustomEdit(FindComponent(pfx + 'id')).Text;
7131-
SubItems.Add(TCustomEdit(FindComponent(pfx + 'point')).Text);
7132-
SubItems.Add(TCustomEdit(FindComponent(pfx + 'position_x')).Text);
7133-
SubItems.Add(TCustomEdit(FindComponent(pfx + 'position_y')).Text);
7134-
SubItems.Add(TCustomEdit(FindComponent(pfx + 'position_z')).Text);
7135-
SubItems.Add(TCustomEdit(FindComponent(pfx + 'waittime')).Text);
7136-
SubItems.Add(TCustomEdit(FindComponent(pfx + 'text1')).Text);
7137-
SubItems.Add(TCustomEdit(FindComponent(pfx + 'text2')).Text);
7138-
SubItems.Add(TCustomEdit(FindComponent(pfx + 'text3')).Text);
7139-
SubItems.Add(TCustomEdit(FindComponent(pfx + 'text4')).Text);
7140-
SubItems.Add(TCustomEdit(FindComponent(pfx + 'text5')).Text);
7141-
SubItems.Add(TCustomEdit(FindComponent(pfx + 'emote')).Text);
7142-
SubItems.Add(TCustomEdit(FindComponent(pfx + 'spell')).Text);
7143-
SubItems.Add(TCustomEdit(FindComponent(pfx + 'wpguid')).Text);
7144-
SubItems.Add(TCustomEdit(FindComponent(pfx + 'orientation')).Text);
7145-
SubItems.Add(TCustomEdit(FindComponent(pfx + 'model1')).Text);
7146-
SubItems.Add(TCustomEdit(FindComponent(pfx + 'model2')).Text);
7147-
end;
7148-
end;
7149-
7150-
procedure TMainForm.MvmntDel(lvList: TJvListView);
7151-
begin
7152-
LootDel(lvList);
7153-
end;
7154-
71557095
procedure TMainForm.SmartAIDel(lvList: TJvListView);
71567096
begin
71577097
LootDel(lvList);
@@ -7162,33 +7102,6 @@ procedure TMainForm.ConditionsDel(lvList: TJvListView);
71627102
LootDel(lvList);
71637103
end;
71647104

7165-
procedure TMainForm.MvmntUpd(pfx: string; lvList: TJvListView);
7166-
begin
7167-
if Assigned(lvList.Selected) then
7168-
begin
7169-
with lvList.Selected do
7170-
begin
7171-
Caption := TCustomEdit(FindComponent(pfx + 'id')).Text;
7172-
SubItems[0] := TCustomEdit(FindComponent(pfx + 'point')).Text;
7173-
SubItems[1] := TCustomEdit(FindComponent(pfx + 'position_x')).Text;
7174-
SubItems[2] := TCustomEdit(FindComponent(pfx + 'position_y')).Text;
7175-
SubItems[3] := TCustomEdit(FindComponent(pfx + 'position_z')).Text;
7176-
SubItems[4] := TCustomEdit(FindComponent(pfx + 'waittime')).Text;
7177-
SubItems[5] := TCustomEdit(FindComponent(pfx + 'text1')).Text;
7178-
SubItems[6] := TCustomEdit(FindComponent(pfx + 'text2')).Text;
7179-
SubItems[7] := TCustomEdit(FindComponent(pfx + 'text3')).Text;
7180-
SubItems[8] := TCustomEdit(FindComponent(pfx + 'text4')).Text;
7181-
SubItems[9] := TCustomEdit(FindComponent(pfx + 'text5')).Text;
7182-
SubItems[10] := TCustomEdit(FindComponent(pfx + 'emote')).Text;
7183-
SubItems[11] := TCustomEdit(FindComponent(pfx + 'spell')).Text;
7184-
SubItems[12] := TCustomEdit(FindComponent(pfx + 'wpguid')).Text;
7185-
SubItems[13] := TCustomEdit(FindComponent(pfx + 'orientation')).Text;
7186-
SubItems[14] := TCustomEdit(FindComponent(pfx + 'model1')).Text;
7187-
SubItems[15] := TCustomEdit(FindComponent(pfx + 'model2')).Text;
7188-
end;
7189-
end;
7190-
end;
7191-
71927105
procedure TMainForm.SmartAIUpd(pfx: string; lvList: TJvListView);
71937106
begin
71947107
if Assigned(lvList.Selected) then
@@ -7273,21 +7186,6 @@ procedure TMainForm.btCreatureModelSearchClick(Sender: TObject);
72737186
end;
72747187
end;
72757188

7276-
procedure TMainForm.btCreatureMvmntAddClick(Sender: TObject);
7277-
begin
7278-
MvmntAdd('edcm', lvcmMovement);
7279-
end;
7280-
7281-
procedure TMainForm.btCreatureMvmntDelClick(Sender: TObject);
7282-
begin
7283-
MvmntDel(lvcmMovement);
7284-
end;
7285-
7286-
procedure TMainForm.btCreatureMvmntUpdClick(Sender: TObject);
7287-
begin
7288-
MvmntUpd('edcm', lvcmMovement);
7289-
end;
7290-
72917189
procedure TMainForm.btCreatureLootDelClick(Sender: TObject);
72927190
begin
72937191
LootDel(lvcoCreatureLoot);
@@ -7414,33 +7312,6 @@ procedure TMainForm.SetLootEditFields(pfx: string;
74147312
end;
74157313
end;
74167314

7417-
procedure TMainForm.SetMvmntEditFields(pfx: string; lvList: TJvListView);
7418-
begin
7419-
if Assigned(lvList.Selected) then
7420-
begin
7421-
with lvList.Selected do
7422-
begin
7423-
TCustomEdit(FindComponent(pfx + 'id')).Text := Caption;
7424-
TCustomEdit(FindComponent(pfx + 'point')).Text := SubItems[0];
7425-
TCustomEdit(FindComponent(pfx + 'position_x')).Text := SubItems[1];
7426-
TCustomEdit(FindComponent(pfx + 'position_y')).Text := SubItems[2];
7427-
TCustomEdit(FindComponent(pfx + 'position_z')).Text := SubItems[3];
7428-
TCustomEdit(FindComponent(pfx + 'waittime')).Text := SubItems[4];
7429-
TCustomEdit(FindComponent(pfx + 'textid1')).Text := SubItems[5];
7430-
TCustomEdit(FindComponent(pfx + 'textid2')).Text := SubItems[6];
7431-
TCustomEdit(FindComponent(pfx + 'textid3')).Text := SubItems[7];
7432-
TCustomEdit(FindComponent(pfx + 'textid4')).Text := SubItems[8];
7433-
TCustomEdit(FindComponent(pfx + 'textid5')).Text := SubItems[9];
7434-
TCustomEdit(FindComponent(pfx + 'emote')).Text := SubItems[10];
7435-
TCustomEdit(FindComponent(pfx + 'spell')).Text := SubItems[11];
7436-
TCustomEdit(FindComponent(pfx + 'wpguid')).Text := SubItems[12];
7437-
TCustomEdit(FindComponent(pfx + 'orientation')).Text := SubItems[13];
7438-
TCustomEdit(FindComponent(pfx + 'model1')).Text := SubItems[14];
7439-
TCustomEdit(FindComponent(pfx + 'model2')).Text := SubItems[15];
7440-
end;
7441-
end;
7442-
end;
7443-
74447315
procedure TMainForm.SetSmartAIEditFields(pfx: string; lvList: TJvListView);
74457316
begin
74467317
if Assigned(lvList.Selected) then
@@ -7896,14 +7767,12 @@ procedure TMainForm.btShowCharacterScriptClick(Sender: TObject);
78967767
procedure TMainForm.btShowFULLCharacterInventoryScriptClick(Sender: TObject);
78977768
begin
78987769
PageControl8.ActivePageIndex := SCRIPT_TAB_NO_CHARACTER;
7899-
// ShowFullLootScript('item_loot_template', lvitItemLoot, meitScript, editentry.Text);
79007770
end;
79017771

79027772
procedure TMainForm.btFullCreatureMovementScriptClick(Sender: TObject);
79037773
begin
79047774
PageControl3.ActivePageIndex := SCRIPT_TAB_NO_CREATURE;
7905-
//mectScript.Text := FullScript('creature_movement', 'id', edclguid.Text); //disable creature_movement
7906-
//ShowFullMvmntScript('creature_movement', lvcmMovement, mectScript, edclguid.Text);
7775+
mectScript.Text := FullScript('creature_template_movement', 'CreatureId', edcmcreatureid.Text);
79077776
end;
79087777

79097778
procedure TMainForm.btFullScriptGOLocationClick(Sender: TObject);

MyDataModule.pas

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -360,6 +360,7 @@ procedure TdmMain.Init;
360360
Text[156]:='LootMode';
361361
Text[157]:='The error has accured while loading Creature EventAI:';
362362
Text[158]:='Please specify a source type!';
363+
Text[159]:='The error has accured while loading Creature Template Movement:';
363364
end;
364365

365366
procedure TdmMain.SetLanguage(const Value: string);

0 commit comments

Comments
 (0)