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

📄 script.pas

📁 仙境传说(RO)私人服务器端源代码。第一次上传。
💻 PAS
📖 第 1 页 / 共 4 页
字号:
					if (tn.ChatRoomID = 0) then begin						tcr := TChatRoom.Create;						tcr.Title := tn.Script[tc.ScriptStep].Data1[0];						tcr.Limit := tn.Script[tc.ScriptStep].Data3[0];						tcr.Pub := 1;						tcr.MemberID[0] := tn.ID; //僆乕僫乕:0						tcr.MemberCID[0] := tn.JID;						tcr.MemberName[0] := tn.Name;						ChatMaxID := ChatMaxID + 1;						tcr.ID := ChatMaxID;						tcr.Users := 1;						tcr.NPCowner := 1;						tn.ChatRoomID := tcr.ID;						ChatRoomList.AddObject(tcr.ID, tcr);						DebugOut.Lines.Add(Format('ChatRoomTitle = %s : OwnerID = %d : OwnerName = %s', [tcr.Title, tcr.MemberID[0], tcr.MemberName[0]]));						//廃曈偵僷働憲怣						w := Length(tcr.Title);						WFIFOW(0, $00d7);						WFIFOW(2, w + 17);						WFIFOL(4, tcr.MemberID[0]);						WFIFOL(8, tcr.ID);						WFIFOW(12, tcr.Limit);						WFIFOW(14, tcr.Users);						WFIFOB(16, tcr.Pub);						WFIFOS(17, tcr.Title, w);						SendBCmd(tm, tn.Point, w + 17, nil);					end;					break;				end;			40: //enablenpc				begin					if Map.IndexOf(tn.Script[tc.ScriptStep].Data1[0]) = -1 then						MapLoad(tn.Script[tc.ScriptStep].Data1[0]);					tm1 := Map.Objects[Map.IndexOf(tn.Script[tc.ScriptStep].Data1[0])] as TMap;					if (tn.Script[tc.ScriptStep].Data3[0] = 1) then begin						//enable						i := -1;						for k := 0 to tm1.NPC.Count - 1 do begin							tn1 := tm1.NPC.Objects[k] as TNPC;							if (tn1.Name = tn.Script[tc.ScriptStep].Data1[1]) then begin								i := 0;								break;							end;						end;						if (tn1.ScriptInitS <> -1) then begin							//OnInit儔儀儖傪幚峴							//DebugOut.Lines.Add(Format('OnInit Event(%d)', [tn1.ID]));							tc1 := TChara.Create;							tc1.TalkNPCID := tn1.ID;							tc1.ScriptStep := tn1.ScriptInitS;							tc1.AMode := 3;							tc1.AData := tn1;							tc1.Login := 0;							NPCScript(tc1,0,1);							tn.ScriptInitD := true;							tc1.Free;						end;						if (i = 0) and (tn1.Enable = false) then begin							tn1.Enable := true;							for j := tn1.Point.Y div 8 - 2 to tn1.Point.Y div 8 + 2 do begin								for i := tn1.Point.X div 8 - 2 to tn1.Point.X div 8 + 2 do begin									for k := 0 to tm1.Block[i][j].CList.Count - 1 do begin										tc1 := tm1.Block[i][j].Clist.Objects[k] as TChara;										if (abs(tc1.Point.X - tn1.Point.X) < 16) and (abs(tc1.Point.Y - tn1.Point.Y) < 16) then begin											SendNData(tc1.Socket, tn1, tc1.ver2);										end;									end;								end;							end;						end;					end else begin						//disable						i := -1;						for k := 0 to tm1.NPC.Count - 1 do begin							tn1 := tm1.NPC.Objects[k] as TNPC;							if (tn1.Name = tn.Script[tc.ScriptStep].Data1[1]) then begin								i := 0;								break;							end;						end;						if (i = 0) and (tn1.Enable = true) then begin							tn1.Enable := false;							l := tm.TimerAct.IndexOf(tn1.ID);							if (l <> -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(tn1.ID));							end;							for j := tn1.Point.Y div 8 - 2 to tn1.Point.Y div 8 + 2 do begin								for i := tn1.Point.X div 8 - 2 to tn1.Point.X div 8 + 2 do begin									for k := 0 to tm1.Block[i][j].CList.Count - 1 do begin										tc1 := tm1.Block[i][j].Clist.Objects[k] as TChara;										if (abs(tc1.Point.X - tn1.Point.X) < 16) and (abs(tc1.Point.Y - tn1.Point.Y) < 16) then begin											WFIFOW(0, $0080);											WFIFOL(2, tn1.ID);											WFIFOB(6, 0);											tc1.Socket.SendBuf(buf, 7);										end;									end;								end;							end;						end;					end;					Inc(tc.ScriptStep);				end;			41: //resetmymob				begin					if Map.IndexOf(tn.Script[tc.ScriptStep].Data1[0]) <> -1 then begin						tm1 := Map.Objects[Map.IndexOf(tn.Script[tc.ScriptStep].Data1[0])] as TMap;						for i := tm1.Mob.Count -1 downto 0 do begin							ts := tm1.Mob.Objects[i] as TMob;							if (ts.isSummon = true) then begin								if (tm1.CList.Count > 0) then begin									WFIFOW( 0, $0080);									WFIFOL( 2, ts.ID);									WFIFOB( 6, 1);									SendBCmd(tm1, ts.Point, 7);								end;								j := tm1.Block[ts.Point.X div 8][ts.Point.Y div 8].Mob.IndexOf(ts.ID);								if (j <> -1) then tm1.Block[ts.Point.X div 8][ts.Point.Y div 8].Mob.Delete(j);								j := tm1.Mob.IndexOf(ts.ID);								if (j <> -1) then tm1.Mob.Delete(j);							end;						end;					end;					Inc(tc.ScriptStep);				end;			42: //getmapusers				begin					if Map.IndexOf(tn.Script[tc.ScriptStep].Data1[0]) <> -1 then begin						tm1 := Map.Objects[Map.IndexOf(tn.Script[tc.ScriptStep].Data1[0])] as TMap;						if (Copy(tn.Script[tc.ScriptStep].Data1[1], 1, 1) <> '\') then begin							tc.Flag.Values[tn.Script[tc.ScriptStep].Data1[1]] := IntToStr(tm1.CList.Count);						end else begin							ServerFlag.Values[tn.Script[tc.ScriptStep].Data1[1]] := IntToStr(tm1.CList.Count);						end;					end;					Inc(tc.ScriptStep);				end;			43: //setstr				begin					j := tn.Script[tc.ScriptStep].Data3[0];					str := '';					//塃曈僼儔僌僠僃僢僋					if (Copy(tn.Script[tc.ScriptStep].Data1[1], 1, 1) = '\') then begin						//僒乕僶嫟桳僼儔僌						str := ServerFlag.Values[tn.Script[tc.ScriptStep].Data1[1]];					end else begin						i := -1;						if (tc.Login = 2) then begin							i := tc.Flag.IndexOfName(tn.Script[tc.ScriptStep].Data1[1]);						end;						if (i <> -1) then begin							//僉儍儔僋僞乕僼儔僌							str := tc.Flag.Values[tn.Script[tc.ScriptStep].Data1[1]];						end else begin							//暥帤楍							str := tn.Script[tc.ScriptStep].Data1[1];						end;					end;					//嵍曈僼儔僌僠僃僢僋					if (Copy(tn.Script[tc.ScriptStep].Data1[0], 1, 1) = '\') then begin						//僒乕僶嫟桳僼儔僌						if (j = 0) then begin							ServerFlag.Values[tn.Script[tc.ScriptStep].Data1[0]] := str;						end else begin							ServerFlag.Values[tn.Script[tc.ScriptStep].Data1[0]] := ServerFlag.Values[tn.Script[tc.ScriptStep].Data1[0]] + str;						end;					end else if (tc.Login = 2) then begin						//僉儍儔僋僞乕僼儔僌						if (j = 0) then begin							tc.Flag.Values[tn.Script[tc.ScriptStep].Data1[0]] := str;						end else begin							tc.Flag.Values[tn.Script[tc.ScriptStep].Data1[0]] := tc.Flag.Values[tn.Script[tc.ScriptStep].Data1[0]] + str;						end;					end;					Inc(tc.ScriptStep);				end;      45: //resetstat				begin          for i := 0 to 5 do begin						tc.ParamBase[i] := 1;					end;					tc.StatusPoint := 48;					for i := 1 to tc.BaseLV - 1 do begin						tc.StatusPoint := tc.StatusPoint + i div 5 + 3;				  end;					CalcStat(tc);          SendCStat(tc);          SendCStat1(tc, 0, $0009, tc.StatusPoint);					Inc(tc.ScriptStep);				end;      46: //resetskill				begin          for i := 2 to 330 do begin          if not tc.Skill[i].Card then          tc.Skill[i].Lv := 0;					end;					if tc.JID = 0 then begin					end else if tc.JID < 7 then tc.SkillPoint := tc.JobLV -1					else tc.SkillPoint := tc.JobLV -1 + 49;					SendCSkillList(tc);          CalcStat(tc);          SendCStat(tc);          SendCStat1(tc, 0, $000c, tc.SkillPoint);					Inc(tc.ScriptStep);				end;      47: //hstyle				begin					i := ConvFlagValue(tc, tn.Script[tc.ScriptStep].Data1[0], true);					if (i >= 0) and (i <= 19) then begin              j := tc.HairColor;						  tc.Hair := i;							WFIFOW(0, $00c3);							WFIFOL(2, tc.ID);							WFIFOB(6, 1);							WFIFOB(7, i);							SendBCmd(tm, tc.Point, 8);							WFIFOW(0, $00c3);							WFIFOL(2, tc.ID);							WFIFOB(6, 6);							WFIFOB(7, j);							SendBCmd(tm, tc.Point, 8);					end;					Inc(tc.ScriptStep);				end;      48: //guildreg				begin          tn.Reg := tn.Script[tc.ScriptStep].Data1[0];					Inc(tc.ScriptStep);				end;      49: //getgskilllevel //S144 addstart				begin{NPC僀儀儞僩捛壛}          j := GuildList.IndexOf(tc.GuildID);          if (j <> -1) then begin          tg := GuildList.Objects[j] as TGuild;					//i := ConvFlagValue(tc, tn.Script[tc.ScriptStep].Data1[0]);          i := StrToInt(tn.Script[tc.ScriptStep].Data1[0]);          //DebugOut.Lines.Add(tn.Script[tc.ScriptStep].Data1[0]);          //DebugOut.Lines.Add(tn.Script[tc.ScriptStep].Data1[1]);					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(tg.GSkill[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(tg.GSkill[i].Lv);						end;					end;          end;{NPC僀儀儞僩捛壛僐僐傑偱}					Inc(tc.ScriptStep);				end;      50: //getguardstatus //S144 addstart				begin{NPC僀儀儞僩捛壛}          j := CastleList.IndexOf(tn.Reg);          if (j <> -1) then begin          tgc := CastleList.Objects[j] as TCastle;					i := ConvFlagValue(tc, tn.Script[tc.ScriptStep].Data1[0]);          //i := StrToInt(tn.Script[tc.ScriptStep].Data1[0]);          //i := i - 1;          //DebugOut.Lines.Add(IntToStr(tgc.GuardStatus[i]));          //DebugOut.Lines.Add(tn.Script[tc.ScriptStep].Data1[0]);          //DebugOut.Lines.Add(tn.Script[tc.ScriptStep].Data1[1]);					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(tgc.GuardStatus[i]);						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(tgc.GuardStatus[i]);						end;					end;          end;{NPC僀儀儞僩捛壛僐僐傑偱}					Inc(tc.ScriptStep);				end;      52: //setguardstatus				begin					i := ConvFlagValue(tc, tn.Script[tc.ScriptStep].Data1[0]);          j := StrToInt(tn.Script[tc.ScriptStep].Data1[1]);          k := CastleList.IndexOf(tn.Reg);          if (k <> -1) then begin          tgc := CastleList.Objects[k] as TCastle;          if (i >= 1) or (i <= 8) then begin					if (j = 0) or (j = 1) then begin          //i := i - 1;          tgc.GuardStatus[i] := 1;					end;          end;          end;					Inc(tc.ScriptStep);				end;      51: //setguildkafra				begin					i := StrToInt(tn.Script[tc.ScriptStep].Data1[0]);					if (i = 0) or (i = 1) then begin          SetGuildKafra(tn,i);          EnableGuildKafra(tn.Map,'Kafra Service',i);					end;					Inc(tc.ScriptStep);				end;      53: //callguard				begin					i := ConvFlagValue(tc, tn.Script[tc.ScriptStep].Data1[0]);          if (i >= 1) or (i <= 8) then begin          CallGuildGuard(tn,i);          end;          Inc(tc.ScriptStep);        end;       54: //callmymob				begin					str := UpperCase(tn.Script[tc.ScriptStep].Data1[0]);          j := ConvFlagValue(tc, tn.Script[tc.ScriptStep].Data1[1]);          k := ConvFlagValue(tc, tn.Script[tc.ScriptStep].Data1[2]);          l := ConvFlagValue(tc, tn.Script[tc.ScriptStep].Data1[3]);          m := ConvFlagValue(tc, tn.Script[tc.ScriptStep].Data1[4]);          SpawnNPCMob(tn,str,j,k,l,m);          Inc(tc.ScriptStep);        end;       55: //resetguild        begin        l := CastleList.IndexOf(tn.Reg);        if (l <> - 1) then begin        CastleList.Delete(l);        end;        Inc(tc.ScriptStep);        end;       56: //guilddinvest        begin          GuildDInvest(tn);          Inc(tc.ScriptStep);        end;			44: //checkstr				begin					j := tn.Script[tc.ScriptStep].Data3[2];					str := '';					//塃曈僼儔僌僠僃僢僋					if (Copy(tn.Script[tc.ScriptStep].Data1[1], 1, 1) = '\') then begin						//僒乕僶嫟桳僼儔僌						str := ServerFlag.Values[tn.Script[tc.ScriptStep].Data1[1]];					end else begin						i := -1;						if (tc.Login = 2) then begin							i := tc.Flag.IndexOfName(tn.Script[tc.ScriptStep].Data1[1]);						end;						if (i <> -1) then begin							//僉儍儔僋僞乕僼儔僌							str := tc.Flag.Values[tn.Script[tc.ScriptStep].Data1[1]];						end else begin							//暥帤楍							str := tn.Script[tc.ScriptStep].Data1[1];						end;					end;					flag := false;					//嵍曈僼儔僌僠僃僢僋					if (Copy(tn.Script[tc.ScriptStep].Data1[0], 1, 1) = '\') then begin						//僒乕僶嫟桳僼儔僌						if (ServerFlag.Values[tn.Script[tc.ScriptStep].Data1[0]] = str) then begin							flag := true;						end;					end else if (tc.Login = 2) then begin						//僉儍儔僋僞乕僼儔僌						DebugOut.Lines.Add(Format('str-check: %s', [tc.Flag.Values[tn.Script[tc.ScriptStep].Data1[0]]]));						if (tc.Flag.Values[tn.Script[tc.ScriptStep].Data1[0]] = str) then begin							flag := true;						end;					end;					DebugOut.Lines.Add(Format('str-check: %s %s %s(%s) = %d', [tn.Script[tc.ScriptStep].Data1[0], tn.Script[tc.ScriptStep].Data1[2], tn.Script[tc.ScriptStep].Data1[1], str, byte(flag)]));					if ((j = 0) and (flag = true)) or ((j = 1) and (flag = false)) then begin						tc.ScriptStep := tn.Script[tc.ScriptStep].Data3[0];					end else begin						tc.ScriptStep := tn.Script[tc.ScriptStep].Data3[1];					end;				end;{NPC僀儀儞僩捛壛僐僐傑偱}			end;    Inc(cnt);		end;		if cnt >= 100 then begin			DebugOut.Lines.Add('script error!!! : infinity loop founded');		end;		if (tc.ScriptStep >= tn.ScriptCnt) or (cnt >= 100) then begin			//僗僋儕僾僩廔椆			tc.AMode := 0;		end;	//end;end;//==============================================================================end.

⌨️ 快捷键说明

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