⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 script.pas

📁 仙境传说(RO)私人服务器端源代码。第一次上传。
💻 PAS
📖 第 1 页 / 共 4 页
字号:
										tn.Script[tc.ScriptStep].Data2[6] := str;									$10: //奪										tn.Script[tc.ScriptStep].Data2[1] := str;                  $20: //嵍庤										tn.Script[tc.ScriptStep].Data2[2] := str;									$22: //椉庤晲婍										begin											tn.Script[tc.ScriptStep].Data2[2] := str;											tn.Script[tc.ScriptStep].Data2[3] := str;										end;									$40: //孋										tn.Script[tc.ScriptStep].Data2[5] := str;									$80: //傾僋僙2										tn.Script[tc.ScriptStep].Data2[7] := str;									$100: //摢忋抜										tn.Script[tc.ScriptStep].Data2[0] := str;									$200: //摢拞抜										tn.Script[tc.ScriptStep].Data2[8] := str;									$201: //摢拞壓抜										begin											tn.Script[tc.ScriptStep].Data2[8] := str;											tn.Script[tc.ScriptStep].Data2[9] := str;										end;									$300: //摢忋拞抜										begin											tn.Script[tc.ScriptStep].Data2[0] := str;											tn.Script[tc.ScriptStep].Data2[8] := str;										end;									$301: //摢忋拞壓抜										begin											tn.Script[tc.ScriptStep].Data2[0] := str;											tn.Script[tc.ScriptStep].Data2[8] := str;											tn.Script[tc.ScriptStep].Data2[9] := str;										end;								end;							end;						end;						for i := 0 to 9 do begin							if i = 0 then								str := tn.Script[tc.ScriptStep].Data2[i]							else								str := str + ':' + tn.Script[tc.ScriptStep].Data2[i];						end;						i := Length(str);						WFIFOW(0, $00b7);						WFIFOW(2, i + 8);						WFIFOL(4, tn.ID);						WFIFOS(8, str, i);						tc.Socket.SendBuf(buf[0], i + 8);						break;					end else begin						if value = $FF then begin              //EqLock夝彍              if tc.EqLock = true then tc.EqLock := false;							tc.ScriptStep := $FFFF;							break;						end;{NPC僀儀儞僩捛壛}						if (Copy(tn.Script[tc.ScriptStep].Data1[0], 1, 1) <> '\') then begin							tc.Flag.Values[tn.Script[tc.ScriptStep].Data1[0]] := IntToStr(value);						end else begin							ServerFlag.Values[tn.Script[tc.ScriptStep].Data1[0]] := IntToStr(value);						end;{NPC僀儀儞僩捛壛僐僐傑偱}						case value of							1:  l := $100; //摢忋抜							2:  l := $10;  //奪							3:  l := $20;  //嵍庤							4:  l := $2;   //塃庤							5:  l := $4;   //尐							6:  l := $40;  //孋							7:  l := $8;   //傾僋僙1							8:  l := $80;  //傾僋僙2							9:  l := $200; //摢忋抜							10: l := $1;   //摢壓抜							else l := 0;						end;						if l <> 0 then begin							k := 0;							j := 99;							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 and l) = l) then begin                  if tc.Item[i].Data.IType = 4 then begin                    j := tc.Item[i].Data.wLV;                  end else begin                    j := 0;                  end;                  k := i;                  break;                end;              end;{NPC僀儀儞僩捛壛}							if (Copy(tn.Script[tc.ScriptStep].Data1[1], 1, 1) <> '\') then begin								tc.Flag.Values[tn.Script[tc.ScriptStep].Data1[1]] := IntToStr(j);							end else begin								ServerFlag.Values[tn.Script[tc.ScriptStep].Data1[1]] := IntToStr(j);							end;							if (Copy(tn.Script[tc.ScriptStep].Data1[2], 1, 1) <> '\') then begin								if k <> 0 then									tc.Flag.Values[tn.Script[tc.ScriptStep].Data1[2]] := IntToStr(tc.Item[i].Refine)								else									tc.Flag.Values[tn.Script[tc.ScriptStep].Data1[2]] := '0';							end else begin								if k <> 0 then									ServerFlag.Values[tn.Script[tc.ScriptStep].Data1[2]] := IntToStr(tc.Item[i].Refine)								else									ServerFlag.Values[tn.Script[tc.ScriptStep].Data1[2]] := '0';							end;{NPC僀儀儞僩捛壛僐僐傑偱}						end;  					value := 0;					end;					Inc(tc.ScriptStep);				end;			31: //lockitem				begin{NPC僀儀儞僩捛壛}					i := ConvFlagValue(tc, tn.Script[tc.ScriptStep].Data1[0], true);{NPC僀儀儞僩捛壛僐僐傑偱}					if i = 0 then tc.EqLock := false						else if i = 1 then tc.EqLock := true;					Inc(tc.ScriptStep);				end;{惛楤NPC婡擻捛壛僐僐傑偱}{敮怓曄峏捛壛}			32: //hcolor				begin{NPC僀儀儞僩捛壛}					i := ConvFlagValue(tc, tn.Script[tc.ScriptStep].Data1[0], true);{NPC僀儀儞僩捛壛僐僐傑偱}					if (i >= 0) and (i <= 8) then begin						tc.HairColor := i;						WFIFOW(0, $00c3);						WFIFOL(2, tc.ID);						WFIFOB(6, 6);						WFIFOB(7, i);						SendBCmd(tc.MData, tc.Point, 8);					end;					Inc(tc.ScriptStep);				end;{敮怓曄峏捛壛僐僐傑偱}{NPC僀儀儞僩捛壛}			33: //callmob				begin					ts := TMob.Create;					with ts do begin						Map := tn.Script[tc.ScriptStep].Data1[0];						Point.X := tn.Script[tc.ScriptStep].Data3[0];						Point.Y := tn.Script[tc.ScriptStep].Data3[1];						if (Point.X = 0) and (Point.Y = 0) then begin							j := 0;							repeat								Point.X := Random(tm.Size.X - 2) + 1;								Point.Y := Random(tm.Size.Y - 2) + 1;								Inc(j);							until (tm.gat[Point.X, Point.Y] and 1 <> 0) or (j = 100);						end;						if (j = 100) then continue;						Name := tn.Script[tc.ScriptStep].Data1[1];						JID := tn.Script[tc.ScriptStep].Data3[2];						Data := MobDB.IndexOfObject(ts.JID) as TMobDB;						ID := NowMobID;						Inc(NowMobID);						//僀儀儞僩愝掕						if (tn.Script[tc.ScriptStep].Data2[0] = '') then Event := 0						else Event := StrToInt(tn.Script[tc.ScriptStep].Data2[0]);						Dir := Random(8);						HP := Data.HP;						Speed := Data.Speed;						SpawnDelay1 := $7FFFFFFF;						SpawnDelay2 := 0;						SpawnType := 0;						SpawnTick := 0;						isLooting := False;						for j:= 1 to 10 do begin							Item[j].ID := 0;							Item[j].Amount := 0;							Item[j].Equip := 0;							Item[j].Identify := 0;							Item[j].Refine := 0;							Item[j].Attr := 0;							Item[j].Card[0] := 0;							Item[j].Card[1] := 0;							Item[j].Card[2] := 0;							Item[j].Card[3] := 0;						end;						if (tn.Script[tc.ScriptStep].Data3[3] = 0) then begin							if Data.isDontMove then								MoveWait := 4294967295							else								MoveWait := Tick + 5000 + Cardinal(Random(10000));							isActive := ts.Data.isActive;						end else begin							MoveWait := timeGetTime();							isActive := true;						end;						ATarget := 0;						ATKPer := 100;						DEFPer := 100;						DmgTick := 0;						Element := Data.Element;						for j := 0 to 31 do begin							EXPDist[j].CData := nil;							EXPDist[j].Dmg := 0;						end;						if Data.MEXP <> 0 then begin							for j := 0 to 31 do begin								MVPDist[j].CData := nil;								MVPDist[j].Dmg := 0;							end;							MVPDist[0].Dmg := Data.HP * 30 div 100; //FA偵30%壛嶼						end;						isSummon := True;						tm.Mob.AddObject(ID, ts);						tm.Block[Point.X div 8][Point.Y div 8].Mob.AddObject(ID, ts);						//廃埻偵憲怣						ZeroMemory(@buf[0], 41);						WFIFOW( 0, $007c);						WFIFOL( 2, ID);						WFIFOW( 6, Speed);						WFIFOW( 8, Stat1);						WFIFOW(10, Stat2);						WFIFOW(20, JID);						WFIFOM1(36, Point, Dir);						SendBCmd(tm,Point,41,nil,true);						Inc(tc.ScriptStep);					end;				end;			34: //broadcast				begin					l := tn.Script[tc.ScriptStep].Data3[0];					str := tn.Script[tc.ScriptStep].Data1[0] + chr(0);					i := AnsiPos('$[', str);					while i <> 0 do begin						j := AnsiPos(']', Copy(str, i + 2, 256));						if j <= 1 then break;						if (Copy(str, i + 2, 1) = '$') then begin							str := Copy(str, 1, i - 1) + tc.Flag.Values[Copy(str, i + 2, j - 1)]  + Copy(str, i + j + 2, 256);						end else if (Copy(str, i + 2, 2) = '\$') then begin							str := Copy(str, 1, i - 1) + ServerFlag.Values[Copy(str, i + 2, j - 1)]  + Copy(str, i + j + 2, 256);						end else begin							k := ConvFlagValue(tc, Copy(str, i + 2, j - 1), true);							if k <> -1 then begin								str := Copy(str, 1, i - 1) + IntToStr(k) + Copy(str, i + j + 2, 256);							end else begin								str := Copy(str, 1, i - 1) + Copy(str, i + j + 2, 256);							end;						end;						i := AnsiPos('$[', str);					end;					str := StringReplace(str, '$codeversion', CodeVersion, [rfReplaceAll]);					str := StringReplace(str, '$charaname', tc.Name, [rfReplaceAll]);          str := StringReplace(str, '$guildname', GetGuildName(tn), [rfReplaceAll]);          str := StringReplace(str, '$guildmaster', GetGuildMName(tn), [rfReplaceAll]);          str := StringReplace(str, '$edegree', IntToStr(GetGuildEDegree(tn)), [rfReplaceAll]);          str := StringReplace(str, '$etrigger', IntToStr(GetGuildETrigger(tn)), [rfReplaceAll]);          str := StringReplace(str, '$ddegree', IntToStr(GetGuildDDegree(tn)), [rfReplaceAll]);          str := StringReplace(str, '$dtrigger', IntToStr(GetGuildDTrigger(tn)), [rfReplaceAll]);					str := StringReplace(str, '$$', '$', [rfReplaceAll]);					str := StringReplace(str, '\\', '\', [rfReplaceAll]);					if ((l mod 100) div 10 = 0) then str := tn.Name + ' : ' + str;					if (l div 100 = 1) then str := 'blue' + str;					w := Length(str) + 4;					WFIFOW(0, $009a);					WFIFOW(2, w);					WFIFOS(4, str, w - 4);					if (l mod 10 = 0) then begin						//僇儗儞僩MAP偺僉儍儔偵憲怣						tm := Map.Objects[Map.IndexOf(tn.Map)] as TMap;						for i := 0 to tm.CList.Count - 1 do begin							tc1 := tm.CList.Objects[i] as TChara;							if tc1.Login = 2 then tc1.Socket.SendBuf(buf, w);						end;					end else begin						//慡儚乕儖僪偺僉儍儔偵憲怣						for i := 0 to CharaName.Count - 1 do begin							tc1 := CharaName.Objects[i] as TChara;							if tc1.Login = 2 then tc1.Socket.SendBuf(buf, w);						end;					end;					Inc(tc.ScriptStep);				end;			35: //npctimer				begin					i := tn.Script[tc.ScriptStep].Data3[0];					j := tm.TimerAct.IndexOf(tn.ID);					if (i = 0) then begin						//僞僀儅乕OFF						if (j <> -1) then begin							DebugOut.Lines.Add(Format('NPC Timer(%d) was deleted / Remaining Timer(%d)', [tn.ID,tm.TimerAct.Count-1]));							tm.TimerAct.Delete(tm.TimerAct.IndexOf(tn.ID));						end;					end else if (i = 1) then begin						//僞僀儅乕ON						if (j = -1) then begin							//怴婯僗僞乕僩							j := tm.TimerDef.IndexOf(tn.ID);							if (j <> -1) then begin								tr := tm.TimerDef.Objects[j] as NTimer;								tr.Tick := timeGetTime();								for k := 0 to tr.Cnt - 1 do begin									tr.Done[k] := 0;								end;								tm.TimerAct.AddObject(tn.ID, tr);								DebugOut.Lines.Add(Format('NPC Timer(%d) was started / Starting Timer(%d)', [tn.ID,tm.TimerAct.Count]));							end;						end else begin							//嵞僗僞乕僩							tr := tm.TimerAct.Objects[j] as NTimer;							tr.Tick := timeGetTime();							for k := 0 to tr.Cnt - 1 do begin								tr.Done[k] := 0;							end;							DebugOut.Lines.Add(Format('NPC Timer(%d) was re-started / Starting Timer(%d)', [tn.ID,tm.TimerAct.Count]));						end;					end;					Inc(tc.ScriptStep);				end;			36: //addnpctimer				begin					i := -1;					for k := 0 to tm.NPC.Count - 1 do begin						tn1 := tm.NPC.Objects[k] as TNPC;						if (tn1.Name = tn.Script[tc.ScriptStep].Data1[0]) then begin							i := 0;							break;						end;					end;					if (i <> -1) then begin						i := tn.Script[tc.ScriptStep].Data3[0];						j := tm.TimerAct.IndexOf(tn1.ID);						if (j <> -1) then begin							tr := tm.TimerAct.Objects[j] as NTimer;							if (i > 0) then tr.Tick := tr.Tick - cardinal(i)							else tr.Tick := tr.Tick + cardinal(abs(i));							if (tr.Tick > Tick) then tr.Tick := Tick;							for k := 0 to tr.Cnt - 1 do begin								if (i < 0) and (tr.Tick + cardinal(tr.Idx[k]) > Tick) then begin									//夁嫀偺僀儀儞僩傪枹幚峴偵偡傞									tr.Done[k] := 0;								end else if (i > 0) and (tr.Tick + cardinal(tr.Idx[k]) < Tick) then begin									//枹棃偺僀儀儞僩傪幚峴嵪偵偡傞									tr.Done[k] := 1;								end;							end;							DebugOut.Lines.Add(Format('NPC Timer(%d) was added (%d)ms', [tn.ID,i]));						end;					end;					Inc(tc.ScriptStep);				end;			37: //return				begin					tc.ScriptStep := $FFFF;					break;				end;			38: //warpallpc				begin					if (tn.Script[tc.ScriptStep].Data3[2] = 0) then begin						//僇儗儞僩MAP偺僉儍儔傪揮憲						tm := Map.Objects[Map.IndexOf(tn.Map)] as TMap;						while (tm.CList.Count > 0) do begin							tc1 := tm.CList.Objects[0] as TChara;							if tc1.Login = 2 then begin								SendCLeave(tc1, 2);								tc1.tmpMap := tn.Script[tc.ScriptStep].Data1[0];								tc1.Point := Point(tn.Script[tc.ScriptStep].Data3[0],tn.Script[tc.ScriptStep].Data3[1]);								MapMove(tc1.Socket, tc1.tmpMap, tc1.Point);							end;						end;					end else if (tn.Script[tc.ScriptStep].Data3[2] = 1) then begin						//慡儚乕儖僪偺僉儍儔傪揮憲						for j := 0 to CharaName.Count - 1 do begin							tc1 := CharaName.Objects[j] as TChara;							if tc1.Login = 2 then begin								SendCLeave(tc1, 2);								tc1.tmpMap := tn.Script[tc.ScriptStep].Data1[0];								tc1.Point := Point(tn.Script[tc.ScriptStep].Data3[0],tn.Script[tc.ScriptStep].Data3[1]);								MapMove(tc1.Socket, tc1.tmpMap, tc1.Point);							end;						end;					end else begin						//NPC僠儍僢僩儖乕儉撪偺僉儍儔傪揮憲						if (tn.ChatRoomID <> 0) then begin							i := ChatRoomList.IndexOf(tn.ChatRoomID);							tcr := ChatRoomList.Objects[i] as TChatRoom;							if (tcr.Users < 2) then continue;							while (tcr.Users > 1) do begin								tc1 := CharaPID.IndexOfObject(tcr.MemberID[1]) as TChara;								if tc1.Login = 2 then begin									SendCLeave(tc1, 2);									tc1.tmpMap := tn.Script[tc.ScriptStep].Data1[0];									tc1.Point := Point(tn.Script[tc.ScriptStep].Data3[0],tn.Script[tc.ScriptStep].Data3[1]);									MapMove(tc1.Socket, tc1.tmpMap, tc1.Point);								end;							end;						end;					end;					Inc(tc.ScriptStep);				end;			39: //waitingroom				begin

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -