📄 script.pas
字号:
SendCStat1(tc, 0, $0018, tc.Weight);
end;
Inc(tc.ScriptStep);
end;
14: //checkitem
begin
{NPC僀儀儞僩捛壛}
i := ConvFlagValue(tc, tn.Script[tc.ScriptStep].Data1[0]);
j := ConvFlagValue(tc, tn.Script[tc.ScriptStep].Data1[1]);
{NPC僀儀儞僩捛壛僐僐傑偱}
k := SearchCInventory(tc, i, false);
if (k <> 0) and (tc.Item[k].Amount >= j) then begin
//debugout.lines.add('[' + TimeToStr(Now) + '] ' + Format('s-checkitem: %d %d = 1', [i, j]));
tc.ScriptStep := tn.Script[tc.ScriptStep].Data3[0];
end else begin
//debugout.lines.add('[' + TimeToStr(Now) + '] ' + Format('s-checkitem: %d %d = 0', [i, j]));
tc.ScriptStep := tn.Script[tc.ScriptStep].Data3[1];
end;
end;
15: //check
begin
str := tn.Script[tc.ScriptStep].Data1[0];
if str = 'zeny' then begin i := tc.Zeny; end
else if str = 'job' then begin
i := tc.JID;
if (i > UPPER_JOB_BEGIN) then i := i - UPPER_JOB_BEGIN + LOWER_JOB_END;
end
else if str = 'baselevel' then begin i := tc.BaseLV; end
else if str = 'joblevel' then begin i := tc.JobLV; end
else if str = 'statuspoint' then begin i := tc.StatusPoint; end
else if str = 'skillpoint' then begin i := tc.SkillPoint; end
else if str = 'Baseexp' then begin i := tc.BaseEXP; end
else if str = 'Jobexp' then begin i := tc.JobEXP; end
else if str = 'option' then begin i := tc.Option; end
else if str = 'speed' then begin i := tc.Speed; end
else if str = 'gender' then begin i := tc.Gender; end
{敮怓曄峏捛壛}
else if str = 'hcolor' then begin i := tc.HairColor; end
else if str = 'guildid' then begin i := GetGuildID(tn); end
else if str = 'guildkafra' then begin i := GetGuildKafra(tn); end
else if str = 'ismyguild' then begin i := CheckGuildID(tn, tc); end
else if str = 'ismymaster' then begin i := CheckGuildMaster(tn, tc); end
else if str = 'etrigger' then begin i := GetGuildETrigger(tn); end
else if str = 'dtrigger' then begin i := GetGuildDTrigger(tn); end
{敮怓曄峏捛壛僐僐傑偱}
else begin
{NPC僀儀儞僩捛壛僐僐傑偱}
i := ConvFlagValue(tc, str);
end;
j := ConvFlagValue(tc, tn.Script[tc.ScriptStep].Data1[1]);
{NPC僀儀儞僩捛壛僐僐傑偱}
case tn.Script[tc.ScriptStep].Data3[2] of
0: flag := boolean(i >= j);
1: flag := boolean(i <= j);
2: flag := boolean(i = j);
3: flag := boolean(i <> j);
4: flag := boolean(i > j);
5: flag := boolean(i < j);
else
begin
//debugout.lines.add('[' + TimeToStr(Now) + '] ' + Format('s-check: invalid formula "%s"', [tn.Script[tc.ScriptStep].Data1[2]]));
tc.ScriptStep := $FFFF;
break;
end;
end;
//debugout.lines.add('[' + TimeToStr(Now) + '] ' + Format('s-check: %s %s(%d) %s = %d', [tn.Script[tc.ScriptStep].Data1[0], tn.Script[tc.ScriptStep].Data1[2], tn.Script[tc.ScriptStep].Data3[2], tn.Script[tc.ScriptStep].Data1[1], byte(flag)]));
if flag then begin
tc.ScriptStep := tn.Script[tc.ScriptStep].Data3[0];
end else begin
tc.ScriptStep := tn.Script[tc.ScriptStep].Data3[1];
end;
end;
16: //checkadditem
begin
{NPC僀儀儞僩捛壛}
i := ConvFlagValue(tc, tn.Script[tc.ScriptStep].Data1[0]);
j := ConvFlagValue(tc, tn.Script[tc.ScriptStep].Data1[1]);
{NPC僀儀儞僩捛壛僐僐傑偱}
td := ItemDB.IndexOfObject(i) as TItemDB;
if tc.MaxWeight >= tc.Weight + cardinal(td.Weight) * cardinal(j) then begin
k := SearchCInventory(tc, i, td.IEquip);
if k <> 0 then begin
tc.ScriptStep := tn.Script[tc.ScriptStep].Data3[0];
end else begin
//傾僀僥儉庬椶悢僆乕僶乕
tc.ScriptStep := tn.Script[tc.ScriptStep].Data3[1];
end;
end else begin
//廳検僆乕僶乕
tc.ScriptStep := tn.Script[tc.ScriptStep].Data3[1];
end;
end;
17: //jobchange
begin
{僶僌曬崘657}
//憰旛夝彍
for i := 1 to 100 do begin
if tc.Item[i].Equip = 32768 then
begin
tc.Item[i].Equip := 0;
WFIFOW(0, $013c);
WFIFOW(2, 0);
tc.Socket.SendBuf(buf, 4);
end else
if tc.Item[i].Equip <> 0 then
begin
reset_skill_effects(tc);
WFIFOW(0, $00ac);
WFIFOW(2, i);
WFIFOW(4, tc.Item[i].Equip);
tc.Item[i].Equip := 0;
WFIFOB(6, 1);
tc.Socket.SendBuf(buf, 7);
remove_equipcard_skills(tc, i);
end;
end;
if (tc.Option <> 0) then begin
tc.Option := 0;
WFIFOW(0, $0119);
WFIFOL(2, tc.ID);
WFIFOW(6, 0);
WFIFOW(8, 0);
WFIFOW(10, tc.Option);
WFIFOB(12, 0);
SendBCmd(tc.MData, tc.Point, 13);
end;
// Colus, 20040304: Adding job offset for upper classes
j := tn.Script[tc.ScriptStep].Data3[0];
if (j > LOWER_JOB_END) then begin
j := j - LOWER_JOB_END + UPPER_JOB_BEGIN; // 24 - 23 + 4000 = 4001, remort novice
tc.ClothesColor := 1; // Use 'default' upper job clothes color
end else begin
tc.ClothesColor := 0; // Default color for regular jobs
end;
tc.JID := j;
tc.JobEXP := 0;
tc.JobLV := 1;
SendCStat1(tc, 0, $0037, tc.JobLV);
CalcStat(tc);
tc.SkillPoint := 0;
//僗僥乕僞僗嵞寁嶼
CalcStat(tc);
SendCStat(tc, true);
SendCSkillList(tc);
// Colus, 20040304: New view packet for jobchange
UpdateLook(tc.MData, tc, 0, tc.JID);
Inc(tc.ScriptStep);
end;
18: //viewpoint
begin
WFIFOW( 0, $0144);
WFIFOL( 2, tn.ID);
WFIFOL( 6, tn.Script[tc.ScriptStep].Data3[0]);
WFIFOL(10, tn.Script[tc.ScriptStep].Data3[1]);
WFIFOL(14, tn.Script[tc.ScriptStep].Data3[2]);
WFIFOB(18, tn.Script[tc.ScriptStep].Data3[3]);
WFIFOL(19, tn.Script[tc.ScriptStep].Data3[4]);
tc.Socket.SendBuf(buf, 23);
Inc(tc.ScriptStep);
end;
19: //input
begin
if value = 0 then begin
WFIFOW( 0, $0142);
WFIFOL( 2, tn.ID);
tc.Socket.SendBuf(buf, 6);
break;
end else begin
//僼儔僌僙僢僩
{NPC僀儀儞僩捛壛}
if (Copy(tn.Script[tc.ScriptStep].Data1[0], 1, 1) <> '\') then begin
tc.Flag.Values[tn.Script[tc.ScriptStep].Data1[0]] := IntToStr(value - 1);
end else begin
ServerFlag.Values[tn.Script[tc.ScriptStep].Data1[0]] := IntToStr(value - 1);
end;
{NPC僀儀儞僩捛壛僐僐傑偱}
Inc(tc.ScriptStep);
end;
end;
20: //random
begin
{NPC僀儀儞僩捛壛}
if (Copy(tn.Script[tc.ScriptStep].Data1[0], 1, 1) <> '\') then begin
tc.Flag.Values[tn.Script[tc.ScriptStep].Data1[0]] := IntToStr(Random(tn.Script[tc.ScriptStep].Data3[0]));
end else begin
ServerFlag.Values[tn.Script[tc.ScriptStep].Data1[0]] := IntToStr(Random(tn.Script[tc.ScriptStep].Data3[0]));
end;
{NPC僀儀儞僩捛壛僐僐傑偱}
Inc(tc.ScriptStep);
end;
21: //option
begin
if tn.Script[tc.ScriptStep].Data3[1] = 1 then begin
case tn.Script[tc.ScriptStep].Data3[0] of
0:
begin
if (tc.Option <> 8) then begin
tc.Option := (tc.Option and $F877) or $0008;
SendCart(tc);
end;
end; //僇乕僩1
1: tc.Option := tc.Option or $0010; //偨偐
2: tc.Option := tc.Option or $0020; //傌偙
3: tc.Option := (tc.Option and $F877) or $0008; //僇乕僩1
4: tc.Option := (tc.Option and $F877) or $0080; //僇乕僩2
5: tc.Option := (tc.Option and $F877) or $0100; //僇乕僩3
6: tc.Option := (tc.Option and $F877) or $0200; //僇乕僩4
7: tc.Option := (tc.Option and $F877) or $0400; //僇乕僩5
end;
end else begin
case tn.Script[tc.ScriptStep].Data3[0] of
0: tc.Option := tc.Option and $F877; //僇乕僩慡夝彍 F847=慡夝彍
1: tc.Option := tc.Option and $FFEF; //偨偐
2: tc.Option := tc.Option and $FFDF; //傌偙
end;
end;
CalcStat(tc);
//尒偨栚曄峏
WFIFOW(0, $0119);
WFIFOL(2, tc.ID);
WFIFOW(6, 0);
WFIFOW(8, 0);
WFIFOW(10, tc.Option);
WFIFOB(12, 0);
SendBCmd(tc.MData, tc.Point, 13);
Inc(tc.ScriptStep);
end;
22: //speed
begin
//僷働憲怣
{NPC僀儀儞僩捛壛}
i := ConvFlagValue(tc, tn.Script[tc.ScriptStep].Data1[0], true);
{NPC僀儀儞僩捛壛僐僐傑偱}
//僗僺乕僪曄峏
if (i >= 25) and (i <= 1000) then begin
tc.Speed := i;
tc.DefaultSpeed := i;
CalcStat(tc);
SendCStat1(tc, 0, 0, tc.Speed);
Inc(tc.ScriptStep);
end;
end;
23: //die
begin
//僷働憲怣
//僾儗乕儎乕懄巰
CalcStat(tc);
tc.HP := 0;
tc.Sit := 1;
SendCStat1(tc, 0, 5, tc.HP);
WFIFOW(0, $0080);
WFIFOL(2, tc.ID);
WFIFOB(6, 1);
tc.Socket.SendBuf(buf, 7);
Inc(tc.ScriptStep);
end;
24: //ccolor
begin
//僷働憲怣
{NPC僀儀儞僩捛壛}
i := ConvFlagValue(tc, tn.Script[tc.ScriptStep].Data1[0], true);
{NPC僀儀儞僩捛壛僐僐傑偱}
//怓曄峏
if (i >= 0) then begin
CalcStat(tc);
tc.ClothesColor := i;
UpdateLook(tc.MData, tc, 7, i, 0, true);
end;
Inc(tc.ScriptStep);
end;
25: //refine refine[itemID][fail][+val]
begin
{NPC僀儀儞僩捛壛}
j := ConvFlagValue(tc, tn.Script[tc.ScriptStep].Data1[0]);
k := ConvFlagValue(tc, tn.Script[tc.ScriptStep].Data1[1]);
l := ConvFlagValue(tc, tn.Script[tc.ScriptStep].Data1[2]);
{NPC僀儀儞僩捛壛僐僐傑偱}
//惛楤
if (j >= 0) and (j <= 10) then begin
for i := 1 to 100 do begin
if (tc.Item[i].ID <> 0) and (tc.Item[i].Amount <> 0) and tc.Item[i].Data.IEquip and
(tc.Item[i].Equip <> 0) and (tc.Item[i].Card[0] <> $00ff) then begin
tc.Item[i].Refine := byte(l);
WFIFOW(0, $0188);
WFIFOW(2, k);
WFIFOW(4, i);
WFIFOW(6, word(l));
tc.Socket.SendBuf(buf, 8);
end;
end;
CalcStat(tc);
WFIFOW(0, $019b);
WFIFOL(2, tc.ID);
WFIFOL(6, 3);
//僷働憲怣
SendBCmd(tc.MData, tc.Point, 10, tc);
SendCStat(tc);
end;
Inc(tc.ScriptStep);
end;
26: //getitemamount
begin
{NPC僀儀儞僩捛壛}
i := ConvFlagValue(tc, tn.Script[tc.ScriptStep].Data1[0]);
{NPC僀儀儞僩捛壛僐僐傑偱}
k := SearchCInventory(tc, i, false);
if k <> 0 then begin
tc.Flag.Values[tn.Script[tc.ScriptStep].Data1[1]] := IntToStr(tc.Item[k].Amount);
end else begin
tc.Flag.Values[tn.Script[tc.ScriptStep].Data1[1]] := '0';
end;
Inc(tc.ScriptStep);
end;
{捛壛:僗僋儕僾僩144}
27: //getskilllevel //S144 addstart
begin
{NPC僀儀儞僩捛壛}
i := ConvFlagValue(tc, tn.Script[tc.ScriptStep].Data1[0]);
if (Copy(tn.Script[tc.ScriptStep].Data1[0], 1, 1) <> '\') then begin
if i = 0 then begin
tc.Flag.Values[tn.Script[tc.ScriptStep].Data1[0]] := '0';
end else begin
tc.Flag.Values[tn.Script[tc.ScriptStep].Data1[1]] := IntToStr(tc.Skill[i].Lv);
end;
end else begin
if i = 0 then begin
ServerFlag.Values[tn.Script[tc.ScriptStep].Data1[0]] := '0';
end else begin
ServerFlag.Values[tn.Script[tc.ScriptStep].Data1[1]] := IntToStr(tc.Skill[i].Lv);
end;
end;
{NPC僀儀儞僩捛壛僐僐傑偱}
Inc(tc.ScriptStep);
end;
28: //setskilllevel
begin
{NPC僀儀儞僩捛壛}
i := ConvFlagValue(tc, tn.Script[tc.ScriptStep].Data1[0]);
if i <> 0 then begin
l := ConvFlagValue(tc, tn.Script[tc.ScriptStep].Data1[1]);
{NPC僀儀儞僩捛壛僐僐傑偱}
if ((0 <= l) and (l <= 10)) then tc.Skill[i].Lv := l;
SendCSKillList(tc);
end;
Inc(tc.ScriptStep);
end; //S144 addend
{捛壛:僗僋儕僾僩144僐僐傑偱}
{惛楤NPC婡擻捛壛}
29: //refinery <-- Turned a few jap comments to what they should mean [Tsusai]
begin
{NPC僀儀儞僩捛壛}
j := ConvFlagValue(tc, tn.Script[tc.ScriptStep].Data1[0]);
k := ConvFlagValue(tc, tn.Script[tc.ScriptStep].Data1[1]);
{NPC僀儀儞僩捛壛僐僐傑偱}
case j of
1: l := $100; //Head
2: l := $10; //Body
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -