Subversion Repository Public Repository

fonline_sdk

This repository has no backups
This repository's network speed is throttled to 100KB/sec

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
// FOS Server

/*EXPORT*/ bool AddMiscPlane( Critter& npc, uint priority, uint waitSecond, NpcPlaneMiscFunc@ func )
{
    NpcPlane@ plane = CreatePlane();
    plane.Type = AI_PLANE_MISC;
    plane.Priority = ( priority == 0 ? AI_PLANE_MISC_PRIORITY : priority );
    plane.Misc_WaitSecond = waitSecond;
    if( func !is null )
        plane.Misc_SetScript( func );
    return npc.AddPlane( plane );
}

/*EXPORT*/ bool AddWalkPlane( Critter& npc, uint entire, uint cut, bool run )
{
    uint16 hX = 0, hY = 0;
    Map@   map = npc.GetMap();
    if( map !is null && map.GetEntireCoords( entire, 0, hX, hY ) )
    {
        return AddWalkPlane( npc, 0, hX, hY, 6, run, cut );
    }
    return false;
}

/*EXPORT*/ bool AddWalkPlane( Critter& npc, uint priority, uint16 hexX, uint16 hexY, uint8 dir, bool run, uint cut )
{
    if( npc.IsNoWalk )
        return false;

    NpcPlane@ plane = CreatePlane();
    plane.Type = AI_PLANE_WALK;
    plane.Priority = ( priority == 0 ? AI_PLANE_WALK_PRIORITY : priority );
    plane.Walk_HexX = hexX;
    plane.Walk_HexY = hexY;
    plane.Walk_Dir = dir;
    plane.Run = run;
    plane.Walk_Cut = cut;
    return npc.AddPlane( plane );
}

/*EXPORT*/ bool AddWalkPlane( Critter& npc, uint priority, int identifier, uint identifierExt, uint16 hexX, uint16 hexY, uint8 dir, bool run, uint cut )
{
    if( npc.IsNoWalk )
        return false;

    NpcPlane@ plane = CreatePlane();
    plane.Type = AI_PLANE_WALK;
    plane.Priority = ( priority == 0 ? AI_PLANE_WALK_PRIORITY : priority );
    plane.Identifier = identifier;
    plane.IdentifierExt = identifierExt;
    plane.Walk_HexX = hexX;
    plane.Walk_HexY = hexY;
    plane.Walk_Dir = dir;
    plane.Run = run;
    plane.Walk_Cut = cut;
    return npc.AddPlane( plane );
}

/*EXPORT*/ bool AddAttackPlane( Critter& npc, uint priority, Critter& target )
{
    NpcPlane@ plane = CreatePlane();
    plane.Type = AI_PLANE_ATTACK;
    plane.Priority = ( priority == 0 ? AI_PLANE_ATTACK_PRIORITY : priority );
    plane.Attack_TargId = target.Id;
    plane.Attack_MinHp = __DeadHitPoints;
    plane.Attack_IsGag = false;
    plane.Attack_GagHexX = 0;
    plane.Attack_GagHexY = 0;
    plane.Attack_LastHexX = target.HexX;
    plane.Attack_LastHexY = target.HexY;
    plane.Run = false;
    return npc.AddPlane( plane );
}

/*EXPORT*/ bool AddAttackPlane( Critter& npc, uint priority, uint critId )
{
    Critter@ target = GetCritter( critId );
    if( target is null )
    {
        Log( "Target not found." );
        return false;
    }

    NpcPlane@ plane = CreatePlane();
    plane.Type = AI_PLANE_ATTACK;
    plane.Priority = ( priority == 0 ? AI_PLANE_ATTACK_PRIORITY : priority );
    plane.Attack_TargId = target.Id;
    plane.Attack_MinHp = __DeadHitPoints;
    plane.Attack_IsGag = false;
    plane.Attack_GagHexX = 0;
    plane.Attack_GagHexY = 0;
    plane.Attack_LastHexX = target.HexX;
    plane.Attack_LastHexY = target.HexY;
    plane.Run = false;
    return npc.AddPlane( plane );
}

/*EXPORT*/ bool AddAttackPlane( Critter& npc, uint priority, Critter& target, int minHp )
{
    NpcPlane@ plane = CreatePlane();
    plane.Type = AI_PLANE_ATTACK;
    plane.Priority = ( priority == 0 ? AI_PLANE_ATTACK_PRIORITY : priority );
    plane.Attack_TargId = target.Id;
    plane.Attack_MinHp = minHp;
    plane.Attack_IsGag = false;
    plane.Attack_GagHexX = 0;
    plane.Attack_GagHexY = 0;
    plane.Attack_LastHexY = target.HexY;
    plane.Attack_LastHexX = target.HexX;
    plane.Run = false;
    return npc.AddPlane( plane );
}

/*EXPORT*/ bool AddAttackPlane( Critter& npc, uint priority, uint critId, int minHp )
{
    Critter@ target = GetCritter( critId );
    if( target is null )
    {
        Log( "Target not found." );
        return false;
    }

    NpcPlane@ plane = CreatePlane();
    plane.Type = AI_PLANE_ATTACK;
    plane.Priority = ( priority == 0 ? AI_PLANE_ATTACK_PRIORITY : priority );
    plane.Attack_TargId = target.Id;
    plane.Attack_MinHp = minHp;
    plane.Attack_IsGag = false;
    plane.Attack_GagHexX = 0;
    plane.Attack_GagHexY = 0;
    plane.Attack_LastHexX = target.HexX;
    plane.Attack_LastHexY = target.HexY;
    plane.Run = false;
    return npc.AddPlane( plane );
}

/*EXPORT*/ bool AddAttackPlane( Critter& npc, uint priority, Critter& target, bool run )
{
    NpcPlane@ plane = CreatePlane();
    plane.Type = AI_PLANE_ATTACK;
    plane.Priority = ( priority == 0 ? AI_PLANE_ATTACK_PRIORITY : priority );
    plane.Attack_TargId = target.Id;
    plane.Attack_MinHp = __DeadHitPoints;
    plane.Attack_IsGag = false;
    plane.Attack_GagHexX = 0;
    plane.Attack_GagHexY = 0;
    plane.Attack_LastHexX = target.HexX;
    plane.Attack_LastHexY = target.HexY;
    plane.Run = run;
    return npc.AddPlane( plane );
}

/*EXPORT*/ bool AddAttackPlane( Critter& npc, uint priority, uint critId, bool run )
{
    Critter@ target = GetCritter( critId );
    if( target is null )
    {
        Log( "Target not found." );
        return false;
    }

    NpcPlane@ plane = CreatePlane();
    plane.Type = AI_PLANE_ATTACK;
    plane.Priority = ( priority == 0 ? AI_PLANE_ATTACK_PRIORITY : priority );
    plane.Attack_TargId = target.Id;
    plane.Attack_MinHp = __DeadHitPoints;
    plane.Attack_IsGag = false;
    plane.Attack_GagHexX = 0;
    plane.Attack_GagHexY = 0;
    plane.Attack_LastHexX = target.HexX;
    plane.Attack_LastHexY = target.HexY;
    plane.Run = run;
    return npc.AddPlane( plane );
}

/*EXPORT*/ bool AddAttackPlane( Critter& npc, uint priority, Critter& target, int minHp, bool run )
{
    NpcPlane@ plane = CreatePlane();
    plane.Type = AI_PLANE_ATTACK;
    plane.Priority = ( priority == 0 ? AI_PLANE_ATTACK_PRIORITY : priority );
    plane.Attack_TargId = target.Id;
    plane.Attack_MinHp = minHp;
    plane.Attack_IsGag = false;
    plane.Attack_GagHexX = 0;
    plane.Attack_GagHexY = 0;
    plane.Attack_LastHexX = target.HexX;
    plane.Attack_LastHexY = target.HexY;
    plane.Run = run;
    return npc.AddPlane( plane );
}

/*EXPORT*/ bool AddAttackPlane( Critter& npc, uint priority, uint critId, int minHp, bool run )
{
    Critter@ target = GetCritter( critId );
    if( target is null )
    {
        Log( "Target not found." );
        return false;
    }

    NpcPlane@ plane = CreatePlane();
    plane.Type = AI_PLANE_ATTACK;
    plane.Priority = ( priority == 0 ? AI_PLANE_ATTACK_PRIORITY : priority );
    plane.Attack_TargId = target.Id;
    plane.Attack_MinHp = minHp;
    plane.Attack_IsGag = false;
    plane.Attack_GagHexX = 0;
    plane.Attack_GagHexY = 0;
    plane.Attack_LastHexX = target.HexX;
    plane.Attack_LastHexY = target.HexY;
    plane.Run = run;
    return npc.AddPlane( plane );
}

/*EXPORT*/ bool AddPickPlane( Critter& npc, uint priority, uint16 hexX, uint16 hexY, hash protoId, uint useItemId, bool toOpen )
{
    NpcPlane@ plane = CreatePlane();
    plane.Type = AI_PLANE_PICK;
    plane.Priority = ( priority == 0 ? AI_PLANE_PICK_PRIORITY : priority );
    plane.Pick_HexX = hexX;
    plane.Pick_HexY = hexY;
    plane.Pick_Pid = protoId;
    plane.Pick_UseItemId = useItemId;
    plane.Pick_ToOpen = toOpen;
    plane.Run = false;
    return npc.AddPlane( plane );
}

/*EXPORT*/ bool AddPickPlane( Critter& npc, uint priority, Item@ item, uint useItemId, bool toOpen )
{
    NpcPlane@ plane = CreatePlane();
    plane.Type = AI_PLANE_PICK;
    plane.Priority = ( priority == 0 ? AI_PLANE_PICK_PRIORITY : priority );
    plane.Pick_HexX = item.HexX;
    plane.Pick_HexY = item.HexY;
    plane.Pick_Pid = item.ProtoId;
    plane.Pick_UseItemId = useItemId;
    plane.Pick_ToOpen = toOpen;
    plane.Run = false;
    return npc.AddPlane( plane );
}

/*EXPORT*/ uint EraseAttackPlane( Critter& npc, Critter& target )
{
    return EraseAttackPlane( npc, target.Id );
}

/*EXPORT*/ uint EraseAttackPlane( Critter& npc, uint critId )
{
    NpcPlane@[] planes;
    uint count = npc.GetPlanes( planes );
    if( count == 0 )
        return 0;

    uint erased = 0;
    for( uint i = 0; i < count; i++ )
    {
        if( planes[ i ].Attack_TargId == critId && npc.ErasePlane( i - erased ) )
            erased++;
    }

    return erased;
}

Commits for fonline_sdk/Modules/Core/NpcPlanes.fos

Diff revisions: vs.
Revision Author Commited Message
646 Diff Diff cvet picture cvet Mon 04 Jul, 2016 14:40:54 +0000

Improved namespaces for scripts.
Now each script module treated as namespace (Gui::Object, Entire::GetEntire).
And now you can access from any module to any module by specifying it namespace.
Disabled features: #include, shared, import.
Script addressation changed from module@func to module::func.

613 Diff Diff cvet picture cvet Tue 24 May, 2016 13:52:25 +0000

Реорганизация движка.

606 Diff Diff cvet picture cvet Mon 23 May, 2016 15:41:24 +0000

Реорганизация движка.

589 Diff Diff cvet picture cvet Sat 07 Nov, 2015 14:48:40 +0000

Продолжена реорганизация.
Вроде более-менее работает.
В ближайшие дни будут залиты правки, если потребуются и лог обновлений.
А также Линуксовые бинарники.

582 Diff Diff cvet picture cvet Sat 24 Oct, 2015 13:38:33 +0000

Реорганизация контента.
Вынос NpcPlanes в Core модуль.

581 Diff Diff cvet picture cvet Sat 24 Oct, 2015 13:06:41 +0000

Реорганизация контента.
Вынос NpcPlanes в Core модуль.

579 Diff Diff cvet picture cvet Sat 24 Oct, 2015 13:03:57 +0000

Реорганизация контента.
Вынос NpcPlanes в Core модуль.

577 Diff Diff cvet picture cvet Sat 24 Oct, 2015 13:00:30 +0000

Реорганизация контента.
Настройка скриптов.

565 Diff Diff cvet picture cvet Sat 24 Oct, 2015 09:57:00 +0000

Реорганизация контента.
Переименование скриптов.

537 cvet picture cvet Mon 21 Sep, 2015 15:06:06 +0000

Введено некое подобие модульной системы организации контента.
Теперь все будет лежать не по отдельным папакам. т.е. скрипты в scripts, диалоги в dialogs и т.п., а в общей папке Modules, в которой можно группировать файлы как удобно.
Предполагается, что папки верхнего уровня это наименование отдельного модуля.
Любые папки в Modules (включая подпапки) начинающиеся с подчеркивания ‘_’ не будут обрабатываться.
Папки с именем ‘Resources’ будут паковаться в ресурсы клиента.
А в папках ‘Texts’ сервер будет искать файлы локализации текстов.
Пока есть только один модуль ‘TLA’, но в будущем он будет разделен на отдельные, например: Core, Traders, Combat и т.п.
Но нужно помнить, что пространство имен у всех контентных файлов (диалоги, прототипы и т.п.) одно и наличие двух одинаковых в разных папках не допускается.