📄 uguild.pas
字号:
GuildNpc := DieGuildNpcList.Items [i];
GuildNpc.Free;
DieGuildNpcList.Delete (i);
end;
for i := GuildNpcList.Count - 1 downto 0 do begin
GuildNpc := GuildNpcList.Items [i];
GuildNpc.EndProcess;
GuildNpc.Free;
GuildNpcList.Delete (i);
end;
TFieldPhone(Manager.Phone).SendMessage (0, FM_DESTROY, BasicData, SubData);
TFieldPhone(Manager.Phone).UnRegisterUser (BasicData.id, BasicData.x, BasicData.y);
inherited EndProcess;
end;
function TGuildObject.MoveStone (aServerID, ax, ay: integer) : Boolean;
var
i, nX, nY : integer;
nIndex : Byte;
SubData : TSubData;
tmpManager : TManager;
GuildNpc : TGuildNpc;
begin
Result := false;
if Manager = nil then exit;
tmpManager := ManagerList.GetManagerByServerID (aServerID);
if tmpManager = nil then exit;
if tmpManager.boMakeGuild = false then exit;
nIndex := TMaper (tmpManager.Maper).GetAreaIndex (aX, aY);
if nIndex = 0 then exit;
if AreaClass.CanMakeGuild (nIndex) = false then exit;
nX := aX; nY := aY;
// TMaper (tmpManager.Maper).GetMoveableXY (nX, nY, 10);
// if not TMaper (tmpManager.Maper).isMoveable (nX, nY) then exit;
TFieldPhone(Manager.Phone).SendMessage (NOTARGETPHONE, FM_DESTROY, BasicData, SubData);
TFieldPhone(Manager.Phone).UnRegisterUser (BasicData.id, BasicData.x, BasicData.y);
SelfData.MapID := aServerID;
SelfData.X := nX; SelfData.Y := nY;
BasicData.x := nx; BasicData.y := ny;
SetManagerClass (tmpManager);
TFieldPhone(Manager.Phone).RegisterUser (BasicData.id, FieldProc, BasicData.X, BasicData.Y);
TFieldPhone(Manager.Phone).SendMessage (NOTARGETPHONE, FM_CREATE, BasicData, SubData);
for i := 0 to GuildNpcList.Count - 1 do begin
GuildNpc := GuildNpcList.Items [i];
GuildNpc.MoveGuildNpc (aServerID, nX, nY);
end;
for i := 0 to DieGuildNpcList.Count - 1 do begin
GuildNpc := DieGuildNpcList.Items [i];
GuildNpc.MoveDieGuildNpc (aServerID, nX, nY);
end;
Result := true;
end;
function TGuildObject.CreateStone (aSysopName : String; aServerID, ax, ay: integer) : Boolean;
var
i, nX, nY : integer;
nIndex : Byte;
SubData : TSubData;
tmpManager : TManager;
GuildNpc : TGuildNpc;
begin
Result := false;
if (aSysopName <> '') and (SelfData.Sysop <> aSysopName) then exit;
tmpManager := ManagerList.GetManagerByServerID (aServerID);
if tmpManager = nil then exit;
if tmpManager.boMakeGuild = false then exit;
nIndex := TMaper (tmpManager.Maper).GetAreaIndex (aX, aY);
if nIndex = 0 then exit;
if AreaClass.CanMakeGuild (nIndex) = false then exit;
nX := aX; nY := aY;
if TMaper (tmpManager.Maper).isGuildStoneArea (nX, nY) = true then exit;
// TMaper (tmpManager.Maper).GetMoveableXY (nX, nY, 10);
// if not TMaper (tmpManager.Maper).isMoveable (nX, nY) then exit;
SelfData.MapID := aServerID;
SelfData.X := nX; SelfData.Y := nY;
BasicData.x := nx; BasicData.y := ny;
SetManagerClass (tmpManager);
Initial;
StartProcess;
for i := 0 to GuildNpcList.Count - 1 do begin
GuildNpc := GuildNpcList.Items [i];
GuildNpc.MoveGuildNpc (aServerID, nX, nY);
end;
for i := 0 to DieGuildNpcList.Count - 1 do begin
GuildNpc := DieGuildNpcList.Items [i];
GuildNpc.MoveDieGuildNpc (aServerID, nX, nY);
end;
Result := true;
end;
function TGuildObject.GetGuildNpcByName (aname: string): integer;
var
i : integer;
GuildNpc : TGuildNpc;
begin
Result := -1;
for i := 0 to GuildNpcList.Count -1 do begin
GuildNpc := GuildNpcList.Items [i];
if GuildNpc.GuildNpcName = aName then begin
Result := i;
exit;
end;
end;
end;
procedure TGuildObject.ChangeGuildNpcName (aOldName, aNewName : String);
var
i : integer;
GuildNpc : TGuildNpc;
begin
for i := 0 to MAX_GUILDNPC_COUNT - 1 do begin
if SelfData.GuildNpc [i].rName = aOldName then begin
SelfData.GuildNpc [i].rName := aNewName;
exit;
end;
end;
end;
procedure TGuildObject.SetWarAlarm (aName, aStr : String);
var
i : Integer;
boFlag : Boolean;
begin
boFlag := false;
if isGuildSysop (aName) then boFlag := true;
if boFlag = false then begin
if isGuildSubSysop (aName) then boFlag := true;
end;
if boFlag = false then exit;
FWarAlarmStr := aStr;
FWarAlarmTick := mmAnsTick;
FWarAlarmStartTick := mmAnsTick;
end;
procedure TGuildObject.Update (CurTick: integer);
var
i, j, nX, nY : integer;
nname: string;
GuildNpc : TGuildNpc;
bo : TBasicObject;
begin
// 2000.09.18 巩颇器凉捞 昏力登绰 泅惑阑 阜扁困秦 刚历 昏力窍绊
// 第捞绢 官肺 积己茄促 by Lee.S.G
for i := GuildNpcList.Count - 1 downto 0 do begin
GuildNpc := GuildNpcList.Items [i];
if GuildNpc.boAllowDelete then begin
GuildNpc.EndProcess;
GuildNpcList.Delete (i);
DieGuildNpcList.Add (GuildNpc);
end;
end;
{
for i := 0 to 5 - 1 do begin
nName := GuildNpcDataClass.GuildNpcDataArr[i].rname;
if nname = '' then continue;
ret := GetGuildNpcByName (nname);
if ret = -1 then begin
xx := GuildNpcDataClass.GuildNpcDataArr[i].rx;
yy := GuildNpcDataClass.GuildNpcDataArr[i].ry;
tempx := 0; tempy := 0;
if not TMaper(Manager.Maper).IsMoveable (xx, yy) then begin
for j := 0 to 32 do begin
GetNearPosition (tempx, tempy);
if TMaper(Manager.Maper).isMoveable (xx + tempx, yy + tempy) then begin
break;
end;
end;
if not TMaper(Manager.Maper).isMoveable (xx + tempx, yy + tempy) then begin
tempx := 0; tempy := 0;
end;
end;
GuildNpc := TGuildNpc.Create;
GuildNpc.SetManagerClass (Manager);
GuildNpc.StartX := xx;
GuildNpc.StartY := yy;
GuildNpc.Initial (TBasicObject(Self), nname, xx+tempx, yy+tempy);
GuildNpc.GuildNpcDataClass := GuildNpcDataClass;
if (GuildMagicName <> '') and (i = 0) then begin
GuildNpc.boMagicNpc := TRUE;
StrPcopy (@GuildNpc.BasicData.Guild, GuildMagicName);
MagicClass.GetMagicData (GuildMagicName, GuildNpc.GuildMagicData, GuildMagicExp);
end;
GuildNpc.StartProcess;
// 2000.09.16 巩颇器凉吝 巩颇公傍捞 瘤沥等 器凉狼 困摹啊 函窍绰巴阑
// 阜扁 困秦 TAnsList俊 Insert Method甫 眠啊窍绊 巩颇器凉狼 积己矫
// 霉锅掳 器凉篮 府胶飘狼 急滴俊 火涝茄促 by Lee.S.G
// AnsList.Add (GuildNpc);
if i = 0 then GuildNpcList.Insert (0, GuildNpc)
else GuildNpcList.Add (GuildNpc);
end;
end;
}
if (Manager <> nil) and (DieGuildNpcList.Count > 0) then begin
for i := DieGuildNpcList.Count - 1 downto 0 do begin
GuildNpc := DieGuildNpcList.Items [i];
nX := GuildNpc.StartX - 3 + Random (6);
nY := GuildNpc.StartY - 3 + Random (6);
TMaper (Manager.Maper).GetMoveableXY (nX, nY, 10);
if TMaper (Manager.Maper).isMoveable (nX, nY) then begin
GuildNpc.BasicData.X := nX;
GuildNpc.BasicData.Y := nY;
GuildNpc.StartProcess;
GuildNpcList.Add (GuildNpc);
DieGuildNpcList.Delete (i);
end;
end;
end;
for i := 0 to GuildNpcList.Count - 1 do begin
GuildNpc := GuildNpcList.Items [i];
GuildNpc.Update (CurTick);
end;
if CurTick > DuraTick + DEC_GUILD_DURA_TICK then begin
DuraTick := CurTick;
Dec (SelfData.Durability);
if boShowGuildDuraValue then begin
BocSay (IntToStr(SelfData.Durability) + '/' + IntToStr (SelfData.MaxDurability));
end;
end;
if (FWarAlarmStr <> '') and (CurTick > FWarAlarmTick + 1000) then begin
UserList.GuildSay (SelfData.Name, SelfData.Name + ': ' + format ('%s', [FWarAlarmStr]));
FWarAlarmTick := CurTick;
if CurTick > FWarAlarmStartTick + 18000 then begin
FWarAlarmTick := 0;
FWArAlarmSTartTick := 0;
FWarAlarmStr := '';
end;
end;
end;
////////////////////////////////////////////////////
//
// === GuildList ===
//
////////////////////////////////////////////////////
constructor TGuildList.Create;
begin
CurProcessPos := 0;
DataList := TList.Create;
LoadFromFile ('.\Guild\CreateGuild.SDB');
end;
destructor TGuildList.Destroy;
begin
SaveToFile ('.\Guild\CreateGuild.SDB');
Clear;
DataList.Free;
inherited Destroy;
end;
procedure TGuildList.Clear;
var
i : Integer;
GuildObject : TGuildObject;
begin
for i := 0 to DataList.Count - 1 do begin
GuildObject := DataList.Items [i];
GuildObject.EndProcess;
GuildObject.Free;
end;
DataList.Clear;
end;
function TGuildList.GetCount: integer;
begin
Result := DataList.Count;
end;
function TGuildList.GetUserGrade (aGuildName, uName: String): string;
var
i : integer;
GuildObject : TGuildObject;
begin
Result := '';
for i := 0 to DataList.Count - 1 do begin
GuildObject := DataList.Items [i];
if GuildObject.GuildName = aGuildName then begin
Result := GuildObject.GetUserGrade (uname);
exit;
end;
end;
end;
function TGuildList.GetGuildServerID (aGuildName : String): Integer;
var
i : integer;
GuildObject : TGuildObject;
begin
Result := -1;
for i := 0 to DataList.Count - 1 do begin
GuildObject := DataList.Items [i];
if GuildObject.GuildName = aGuildName then begin
if GuildObject.boAllowDelete = false then begin
Result := GuildObject.SelfData.MapID;
exit;
end;
end;
end;
end;
procedure TGuildList.GetGuildInfo (aGuildName: string; aUser: TUser);
var
i : integer;
GuildObject : TGuildObject;
begin
for i := 0 to DataList.Count -1 do begin
GuildObject := DataList.Items [i];
if GuildObject.GuildName = aGuildName then begin
GuildObject.GetGuildInfo (aUser);
exit;
end;
end;
end;
function TGuildList.CheckGuildUser (aGuildName, aName : String) : Boolean;
var
i : integer;
GuildObject : TGuildObject;
begin
Result := FALSE;
for i := 0 to DataList.Count - 1 do begin
GuildObject := DataList.Items [i];
if GuildObject.GuildName <> aGuildName then continue;
if GuildObject.IsGuildUser(aName) = true then begin
Result := TRUE;
exit;
end;
end;
end;
procedure TGuildList.AllowGuildName (gid: integer; aboAllow: Boolean; aGuildName, aSysopName: string);
var
i : integer;
pd : PTCreateGuildData;
GuildObject: TGuildObject;
begin
for i := 0 to DataList.Count - 1 do begin
GuildObject := DataList.Items [i];
if GuildObject.BasicData.id = gid then begin
if aboAllow = true then begin
pd := GuildObject.GetSelfData;
GuildObject.BocSay (format ('巩颇捞抚篮 %s涝聪促.',[aGuildName]));
pd^.Sysop := aSysopName;
StrPCopy (@GuildObject.BasicData.Name, aGuildName);
StrPCopy (@GuildObject.BasicData.ViewName, aGuildName);
pd^.Name := aGuildName;
GuildObject.FGuildName := aGuildName;
GuildObject.BocChangeFeature;
pd^.MakeDate := DateToStr (Date);
end else begin
GuildObject.BocSay ('巩颇甫 父甸 荐 绝嚼聪促.');
end;
exit;
end;
end;
end;
function TGuildList.AllowGuildCondition (gname, uname: string): Boolean;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -