View difference between Paste ID: ccTa8M0Q and n4McueUx
SHOW: | | - or go back to the newest paste.
1
(Extract Code by HYZ - Chillax GOD)
2
------------------------------------------------------------------------------------------
3
------------------------------------------------------------------------------------------
4
------------------------------------------------------------------------------------------
5
------------------------------------------------------------------------------------------
6
WARZ.sln
7
------------------------------------------------------------------------------------------
8
------------------------------------------------------------------------------------------
9
------------------------------------------------------------------------------------------
10
------------------------------------------------------------------------------------------
11
AI_Player.cpp
12
Find
13
void obj_Player::ReloadWeaponFromSlot(int wpnSlot, int ammoSlot, int amount)
14
Place
15
void obj_Player::OpenChangeNameBox(int wpnSlot) //HYZ:NameColorBox
16
{
17
	r3d_assert(NetworkLocal);
18
19
	wiInventoryItem& bckItm = CurLoadout.Items[wpnSlot];
20
21
	PKT_C2S_OpenNameColorBox_s n;
22
	n.ItemSlot = wpnSlot;
23
	n.ItemCfg = bckItm;
24
	p2pSendToHost(this, &n, sizeof(n));
25
26
	return;
27
}
28
------------------------------------------------------------------------------------------
29
AI_Player.h
30
------------------------------------------------------------------------------------------
31
Find
32
// hit marker
33
Place
34
void		OpenChangeNameBox(int wid); //HYZ:NameColorBox
35
------------------------------------------------------------------------------------------
36
BaseItemConfig.cpp
37
------------------------------------------------------------------------------------------
38
Find
39
bool BaseItemConfig::loadBaseFromXml(pugi::xml_node& xmlItem)
40
Place
41
m_ChangeNameColor = xmlItem.child("NameColorData").attribute("color").as_int(); //HYZ:NameColorBox
42
------------------------------------------------------------------------------------------
43
BaseItemConfig.h
44
------------------------------------------------------------------------------------------
45
Find
46
float	m_Weight;
47
Place
48
int m_ChangeNameColor; //HYZ:NameColorBox
49
Find
50
BaseItemConfig(uint32_t id)
51
Place
52
m_ChangeNameColor = 0; //HYZ:NameColorBox
53
------------------------------------------------------------------------------------------
54
WeaponArmory.cpp
55
------------------------------------------------------------------------------------------
56
Find
57
const ModelItemConfig* WeaponArmory::getAccountItemConfig(uint32_t itemID)
58
Find In funtion
59
if(m_itemsHash.GetObject(itemID, &item))
60
Replace
61
if(item->category >= storecat_Account && item->category <= storecat_LootBox || item->category == storecat_ChangeNameColor) //HYZ:NameColorBox
62
			return (ModelItemConfig*)item;
63
------------------------------------------------------------------------------------------
64
UserProfile.cpp
65
------------------------------------------------------------------------------------------
66
Find
67
case storecat_CraftRecipe:
68
Place
69
case storecat_ChangeNameColor: //HYZ:NameColorBox
70
------------------------------------------------------------------------------------------
71
UserProfile.h
72
------------------------------------------------------------------------------------------
73
Find
74
storecat_Water		= 33,	// water
75
Place
76
storecat_ChangeNameColor = 36, //HYZ:NameColorBox
77
------------------------------------------------------------------------------------------
78
FrontEndShared.cpp
79
------------------------------------------------------------------------------------------
80
Find
81
const size_t foodSize = allFood.size();
82
Place
83
const size_t itemSize = allItem.size();
84
	for(size_t i = 0; i < itemSize; ++i)
85
	{
86
		const ModelItemConfig* gear = allItem[i];
87
88
		if (gear->category == storecat_ChangeNameColor) //HYZ:NameColorBox
89
		{
90
			var[0].SetUInt(gear->m_itemID);
91
			var[1].SetNumber(gear->category);
92
			var[2].SetString(gear->m_StoreName);
93
			var[3].SetString(gear->m_Description);
94
			var[4].SetString(gear->m_StoreIcon);
95
			gfxMovie.Invoke("_root.api.addItem", var, 5);
96
		}
97
98
		var[0].SetUInt(gear->m_itemID);
99
		var[1].SetNumber(gear->category);
100
		var[2].SetString(gear->m_StoreName);
101
		var[3].SetString(gear->m_Description);
102
		var[4].SetString(gear->m_StoreIcon);
103
		var[5].SetBoolean(false); // is stackable
104
		var[6].SetNumber(gear->m_Weight);
105
		gfxMovie.Invoke("_root.api.addItem", var, 7);
106
	}
107
Find
108
var[0].SetNumber(storecat_HeroPackage);
109
Place
110
var[0].SetNumber(storecat_ChangeNameColor);
111
	var[1].SetString("storecat_ChangeNameColor");
112
	var[2].SetNumber(9);
113
	var[3].SetNumber(-1);
114
	gfxMovie.Invoke("_root.api.addCategory", var, 4); //HYZ:NameColorBox
115
------------------------------------------------------------------------------------------
116
HUDPause.cpp
117
------------------------------------------------------------------------------------------
118
Find
119
if(itm->m_itemID!=WeaponConfig::ITEMID_Binoculars && itm->m_itemID!=WeaponConfig::ITEMID_RangeFinder
120
				&& itm->m_itemID!=WeaponConfig::ITEMID_RepairKit && itm->m_itemID!=WeaponConfig::ITEMID_PremRepairKit
121
Place
122
 && itm->category != storecat_ChangeNameColor //HYZ:NameColorBox
123
Find
124
// check if player has repair kits, if yes, show repair context menu
125
Place above
126
if (itm->category == storecat_ChangeNameColor)
127
	{
128
		var[0].SetString("$FR_OPEN_CASE"); //HYZ:NameColorBox
129
		var[1].SetInt(HPA_OPEN_CASEZ);
130
		gfxMovie.Invoke("_root.api.Main.Inventory.addContextMenuOption", var, 2);
131
	}
132
Find
133
if(actionID == HPA_UNLOAD_WEAPON_CLIP)
134
Place
135
else if (actionID == HPA_OPEN_CASEZ)
136
	{
137
		wiInventoryItem& wi = plr->CurLoadout.Items[slotID];
138
139
		const BaseItemConfig* item = g_pWeaponArmory->getConfig(wi.itemID);
140
		if (item) //HYZ:NameColorBox
141
		{
142
			if (item->category == storecat_ChangeNameColor)
143
			{
144
				plr->OpenChangeNameBox(slotID);
145
			}
146
		}
147
148
		updateSurvivorTotalWeight();
149
		gfxMovie.Invoke("_root.api.backpackGridSwapSuccess", "");
150
	}
151
------------------------------------------------------------------------------------------
152
P2PMessages.h
153
------------------------------------------------------------------------------------------
154
Find
155
PKT_LAST_PACKET_ID
156
Place
157
PKT_C2S_OpenNameColorBox, //HYZ:NameColorBox
158
Find
159
struct PKT_C2S_ValidateConnectingPeer_s : public DefaultPacketMixin<PKT_C2S_ValidateConnectingPeer>
160
{
161
	DWORD		protocolVersion;
162
	// must be set by client to correctly connect to game server
163
	__int64		sessionId;
164
	DWORD	    crcgame;
165
};
166
Place
167
struct PKT_C2S_OpenNameColorBox_s : public DefaultPacketMixin<PKT_C2S_OpenNameColorBox> //HYZ:NamecolorBox
168
{
169
	wiInventoryItem ItemCfg;
170
	BYTE		    ItemSlot;	
171
}; 
172
------------------------------------------------------------------------------------------
173
------------------------------------------------------------------------------------------
174
------------------------------------------------------------------------------------------
175
------------------------------------------------------------------------------------------
176
WARZ_SERVER.sln
177
------------------------------------------------------------------------------------------
178
------------------------------------------------------------------------------------------
179
------------------------------------------------------------------------------------------
180
------------------------------------------------------------------------------------------
181
obj_ServerPlayer.cpp
182
------------------------------------------------------------------------------------------
183
Find
184
DEFINE_GAMEOBJ_PACKET_HANDLER(PKT_C2S_CraftItem);
185
Place
186
DEFINE_GAMEOBJ_PACKET_HANDLER(PKT_C2S_OpenNameColorBox); //HYZ:NameColorBox
187
Find
188
int obj_ServerPlayer::GetVehicleType()
189
Place
190
void obj_ServerPlayer::OnNetPacket(const PKT_C2S_OpenNameColorBox_s& n) //HYZ:NameColorBox
191
{
192
	if (n.ItemSlot >= loadout_->BackpackSize) {
193
		gServerLogic.LogCheat(peerId_, PKT_S2C_CheatWarning_s::CHEAT_Protocol, true, "PKT_C2S_OpenNameColorBox_s",
194
			"slot: %d", n.ItemSlot);
195
		return;
196
	}
197
	wiInventoryItem& wi = loadout_->Items[n.ItemSlot];
198
	uint32_t usedItemId = wi.itemID;
199
200
	const BaseItemConfig* itemCfg = g_pWeaponArmory->getConfig(wi.itemID);
201
	if (itemCfg->category != storecat_ChangeNameColor)
202
	{
203
		gServerLogic.LogCheat(peerId_, PKT_S2C_CheatWarning_s::CHEAT_Protocol, true, "PKT_C2S_OpenNameColorBox_s",
204
			"itemid: %d", wi.itemID);
205
		return;
206
	}
207
208
	if (wi.quantity <= 0) {
209
		gServerLogic.LogCheat(peerId_, PKT_S2C_CheatWarning_s::CHEAT_UseItem, true, "PKT_C2S_OpenNameColorBox_s",
210
			"%d", wi.quantity);
211
		return;
212
	}
213
214
	{
215
		PKT_S2C_PlayerNameJoined_s n2;
216
		n2.playerIdx = (WORD)(GetNetworkID() - NETID_PLAYERS_START);
217
		r3dscpy(n2.gamertag, userName);
218
		n2.reputation = loadout_->Stats.Reputation;
219
		n2.ClanID = loadout_->ClanID;
220
		n2.flags = 0;
221
		n2.GlowColor = loadout_->GlowName = itemCfg->m_ChangeNameColor;
222
223
		if(profile_.ProfileData.AccountType == 0) // legend
224
			n2.flags |= 1;
225
		if(profile_.ProfileData.isDevAccount & wiUserProfile::DAA_DEV_ICON)
226
			n2.flags |= 2;
227
		if(profile_.ProfileData.AccountType == 54) // punisher
228
			n2.flags |= 4;
229
		if(profile_.ProfileData.PremiumAcc > 0)
230
			n2.flags |= 8;
231
232
		gServerLogic.p2pBroadcastToAll(&n2, sizeof(n2), true);
233
	}
234
235
	// remove used item
236
	AdjustBackpackSlotQuantity(n.ItemSlot, -1);
237
238
	gServerLogic.ApiPlayerUpdateChar(this);
239
240
	// unlock player backpack, op is complete.
241
	PKT_S2C_BackpackUnlock_s n3;
242
	gServerLogic.p2pSendToPeer(peerId_, this, &n3, sizeof(n3));
243
}
244
Find
245
Place
246
------------------------------------------------------------------------------------------
247
obj_ServerPlayer.h
248
------------------------------------------------------------------------------------------
249
Find
250
void		OnNetPacket(const PKT_C2S_CraftItem_s& n);
251
Place
252
void		OnNetPacket(const PKT_C2S_OpenNameColorBox_s& n); //HYZ:NameColorBox
253
------------------------------------------------------------------------------------------
254
AsyncFuncs.cpp
255
------------------------------------------------------------------------------------------
256
Find
257
req.AddParam("r3",          ResMetal);
258
Place
259
req.AddParam("n23",          NameColor); //HYZ:NameColorBox
260
------------------------------------------------------------------------------------------
261
AsyncFuncs.h
262
------------------------------------------------------------------------------------------
263
Find
264
int		ResMetal;
265
Place
266
int     NameColor; //HYZ:NameColorBox
267
------------------------------------------------------------------------------------------
268
------------------------------------------------------------------------------------------
269
------------------------------------------------------------------------------------------
270
------------------------------------------------------------------------------------------
271
ItemsDB.xml
272
------------------------------------------------------------------------------------------
273
------------------------------------------------------------------------------------------
274
------------------------------------------------------------------------------------------
275
------------------------------------------------------------------------------------------
276
<Item itemID="501400" category="36" Weight="0">
277
            <NameColorData color="1"/>
278
			<Model file="Data/ObjectsDepot/REF_CaseBox/Loot_Drop_Moonnight.sco" />
279
            <Store name="Char_NameColor_Purple" icon="$Data/Weapons/StoreIcons/Color1.dds" desc="" LevelRequired="0" />
280
        </Item>
281
        <Item itemID="501401" category="36" Weight="0">
282
            <NameColorData color="2"/>
283
			<Model file="Data/ObjectsDepot/REF_CaseBox/Loot_Drop_Moonnight.sco" />
284
            <Store name="Char_NameColor_SkyBlue" icon="$Data/Weapons/StoreIcons/Color2.dds" desc="" LevelRequired="0" />
285
        </Item>
286
        <Item itemID="501402" category="36" Weight="0">
287
            <NameColorData color="3"/>
288
			<Model file="Data/ObjectsDepot/REF_CaseBox/Loot_Drop_Moonnight.sco" />
289
            <Store name="Char_NameColor_Blue" icon="$Data/Weapons/StoreIcons/Color3.dds" desc="" LevelRequired="0" />
290
        </Item>
291
        <Item itemID="501403" category="36" Weight="0">
292
            <NameColorData color="4"/>
293
			<Model file="Data/ObjectsDepot/REF_CaseBox/Loot_Drop_Moonnight.sco" />
294
            <Store name="Char_NameColor_GreenLight" icon="$Data/Weapons/StoreIcons/Color4.dds" desc="" LevelRequired="0" />
295
        </Item>
296
        <Item itemID="501404" category="36" Weight="0">
297
            <NameColorData color="5"/>
298
			<Model file="Data/ObjectsDepot/REF_CaseBox/Loot_Drop_Moonnight.sco" />
299
            <Store name="Char_NameColor_Yellow" icon="$Data/Weapons/StoreIcons/Color5.dds" desc="" LevelRequired="0" />
300
        </Item>
301
        <Item itemID="501405" category="36" Weight="0">
302
            <NameColorData color="6"/>
303
			<Model file="Data/ObjectsDepot/REF_CaseBox/Loot_Drop_Moonnight.sco" />
304
            <Store name="Char_NameColor_Orenge" icon="$Data/Weapons/StoreIcons/Color6.dds" desc="" LevelRequired="0" />
305
        </Item>
306
        <Item itemID="501406" category="36" Weight="0">
307
            <NameColorData color="7"/>
308
			<Model file="Data/ObjectsDepot/REF_CaseBox/Loot_Drop_Moonnight.sco" />
309
            <Store name="Char_NameColor_Red" icon="$Data/Weapons/StoreIcons/Color7.dds" desc="" LevelRequired="0" />
310
        </Item>
311
        <Item itemID="501407" category="36" Weight="0">
312
            <NameColorData color="8"/>
313
			<Model file="Data/ObjectsDepot/REF_CaseBox/Loot_Drop_Moonnight.sco" />
314
            <Store name="Char_NameColor_Pink" icon="$Data/Weapons/StoreIcons/Color8.dds" desc="" LevelRequired="0" />
315
        </Item>
316
        <Item itemID="501408" category="36" Weight="0">
317
            <NameColorData color="9"/>
318
			<Model file="Data/ObjectsDepot/REF_CaseBox/Loot_Drop_Moonnight.sco" />
319
            <Store name="Char_NameColor_GreenPussy" icon="$Data/Weapons/StoreIcons/Color9.dds" desc="" LevelRequired="0" />
320
        </Item>
321
        <Item itemID="501409" category="36" Weight="0">
322
            <NameColorData color="20"/>
323
			<Model file="Data/ObjectsDepot/REF_CaseBox/Loot_Drop_Moonnight.sco" />
324
            <Store name="Char_NameColor_Black" icon="$Data/Weapons/StoreIcons/Color10.dds" desc="" LevelRequired="0" />
325
        </Item>
326
------------------------------------------------------------------------------------------
327
------------------------------------------------------------------------------------------
328
------------------------------------------------------------------------------------------
329
------------------------------------------------------------------------------------------
330
ปรับเลข SQL ตรง 
331
<NameColorData color="5"/>
332
ปรับเป็นเลข color ของซอสตัวเองเลย