mirror of
https://github.com/Znote/ZnoteAAC.git
synced 2025-04-29 18:59:21 +02:00
Fix #369 - Outfit offer type (5) supports 2 outfit ids.
This commit is contained in:
parent
be8b882166
commit
b65c860b66
@ -35,24 +35,37 @@ function onSay(cid, words, param)
|
|||||||
-- Get wheight
|
-- Get wheight
|
||||||
local playerCap = getPlayerFreeCap(cid)
|
local playerCap = getPlayerFreeCap(cid)
|
||||||
local itemweight = getItemWeight(q_itemid, q_count)
|
local itemweight = getItemWeight(q_itemid, q_count)
|
||||||
if playerCap >= itemweight then
|
if playerCap >= itemweight then
|
||||||
db.query("DELETE FROM `znote_shop_orders` WHERE `id` = " .. q_id .. ";")
|
db.query("DELETE FROM `znote_shop_orders` WHERE `id` = " .. q_id .. ";")
|
||||||
doPlayerAddItem(cid, q_itemid, q_count)
|
doPlayerAddItem(cid, q_itemid, q_count)
|
||||||
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Congratulations! You have recieved ".. q_count .." "..getItemName(q_itemid).."(s)!")
|
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Congratulations! You have recieved ".. q_count .." "..getItemName(q_itemid).."(s)!")
|
||||||
else
|
else
|
||||||
doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING, "Need more CAP!")
|
doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING, "Need more CAP!")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
-- ORDER TYPE 5 (Outfit and addon)
|
-- ORDER TYPE 5 (Outfit and addon)
|
||||||
if q_type == 5 then
|
if q_type == 5 then
|
||||||
served = true
|
served = true
|
||||||
-- Make sure player don't already have this outfit and addon
|
|
||||||
if not canPlayerWearOutfit(cid, q_itemid, q_count) then
|
local itemid = q_itemid
|
||||||
db.query("DELETE FROM `znote_shop_orders` WHERE `id` = " .. q_id .. ";")
|
local outfits = {}
|
||||||
doPlayerAddOutfit(cid,q_itemid,q_count)
|
|
||||||
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Congratulations! You have received a new outfit!")
|
if itemid > 1000 then
|
||||||
else
|
local first = math.floor(itemid/1000)
|
||||||
doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING, "You already have this outfit and addon!")
|
table.insert(outfits, first)
|
||||||
|
itemid = itemid - (first * 1000)
|
||||||
|
end
|
||||||
|
table.insert(outfits, itemid)
|
||||||
|
|
||||||
|
for _, outfitId in pairs(outfits) do
|
||||||
|
-- Make sure player don't already have this outfit and addon
|
||||||
|
if not canPlayerWearOutfit(cid, outfitId, q_count) then
|
||||||
|
db.query("DELETE FROM `znote_shop_orders` WHERE `id` = " .. q_id .. ";")
|
||||||
|
doPlayerAddOutfit(cid,outfitId,q_count)
|
||||||
|
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Congratulations! You have received a new outfit!")
|
||||||
|
else
|
||||||
|
doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING, "You already have this outfit and addon!")
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -48,14 +48,27 @@ function onSay(cid, words, param)
|
|||||||
-- ORDER TYPE 5 (Outfit and addon)
|
-- ORDER TYPE 5 (Outfit and addon)
|
||||||
if q_type == 5 then
|
if q_type == 5 then
|
||||||
served = true
|
served = true
|
||||||
-- Make sure player don't already have this outfit and addon
|
|
||||||
if not canPlayerWearOutfit(cid, q_itemid, q_count) then
|
local itemid = q_itemid
|
||||||
local delete = db.storeQuery("DELETE FROM `znote_shop_orders` WHERE `id` = " .. q_id .. ";")
|
local outfits = {}
|
||||||
result.free(delete)
|
|
||||||
doPlayerAddOutfit(cid,q_itemid,q_count)
|
if itemid > 1000 then
|
||||||
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Congratulations! You have received a new outfit!")
|
local first = math.floor(itemid/1000)
|
||||||
else
|
table.insert(outfits, first)
|
||||||
doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING, "You already have this outfit and addon!")
|
itemid = itemid - (first * 1000)
|
||||||
|
end
|
||||||
|
table.insert(outfits, itemid)
|
||||||
|
|
||||||
|
for _, outfitId in pairs(outfits) do
|
||||||
|
-- Make sure player don't already have this outfit and addon
|
||||||
|
if not canPlayerWearOutfit(cid, outfitId, q_count) then
|
||||||
|
local delete = db.storeQuery("DELETE FROM `znote_shop_orders` WHERE `id` = " .. q_id .. ";")
|
||||||
|
result.free(delete)
|
||||||
|
doPlayerAddOutfit(cid,outfitId,q_count)
|
||||||
|
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Congratulations! You have received a new outfit!")
|
||||||
|
else
|
||||||
|
doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING, "You already have this outfit and addon!")
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -58,13 +58,26 @@ function onSay(cid, words, param)
|
|||||||
-- ORDER TYPE 5 (Outfit and addon)
|
-- ORDER TYPE 5 (Outfit and addon)
|
||||||
if q_type == 5 then
|
if q_type == 5 then
|
||||||
served = true
|
served = true
|
||||||
-- Make sure player don't already have this outfit and addon
|
|
||||||
if not canPlayerWearOutfit(cid, q_itemid, q_count) then
|
local itemid = q_itemid
|
||||||
db.executeQuery("DELETE FROM `znote_shop_orders` WHERE `id` = " .. q_id .. ";")
|
local outfits = {}
|
||||||
doPlayerAddOutfit(cid,q_itemid,q_count)
|
|
||||||
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Congratulations! You have received a new outfit!")
|
if itemid > 1000 then
|
||||||
else
|
local first = math.floor(itemid/1000)
|
||||||
doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING, "You already have this outfit and addon!")
|
table.insert(outfits, first)
|
||||||
|
itemid = itemid - (first * 1000)
|
||||||
|
end
|
||||||
|
table.insert(outfits, itemid)
|
||||||
|
|
||||||
|
for _, outfitId in pairs(outfits) do
|
||||||
|
-- Make sure player don't already have this outfit and addon
|
||||||
|
if not canPlayerWearOutfit(cid, outfitId, q_count) then
|
||||||
|
db.executeQuery("DELETE FROM `znote_shop_orders` WHERE `id` = " .. q_id .. ";")
|
||||||
|
doPlayerAddOutfit(cid,outfitId,q_count)
|
||||||
|
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Congratulations! You have received a new outfit!")
|
||||||
|
else
|
||||||
|
doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING, "You already have this outfit and addon!")
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -65,16 +65,29 @@ function onThink(interval, lastExecution)
|
|||||||
-- ORDER TYPE 5 (Outfit and addon)
|
-- ORDER TYPE 5 (Outfit and addon)
|
||||||
if orderType == 5 then
|
if orderType == 5 then
|
||||||
served = true
|
served = true
|
||||||
-- Make sure player don't already have this outfit and addon
|
|
||||||
if not player:hasOutfit(orderItemId, orderCount) then
|
local itemid = orderItemId
|
||||||
db.query("DELETE FROM `znote_shop_orders` WHERE `id` = " .. orderId .. ";")
|
local outfits = {}
|
||||||
player:addOutfit(orderItemId)
|
|
||||||
player:addOutfitAddon(orderItemId, orderCount)
|
if itemid > 1000 then
|
||||||
player:sendTextMessage(MESSAGE_INFO_DESCR, "Congratulations! You have received a new outfit!")
|
local first = math.floor(itemid/1000)
|
||||||
print("Process complete. [".. player:getName() .."] has recieved outfit: ["..orderItemId.."] with addon: ["..orderCount.."]")
|
table.insert(outfits, first)
|
||||||
else -- Already has outfit
|
itemid = itemid - (first * 1000)
|
||||||
player:sendTextMessage(MESSAGE_STATUS_WARNING, "You already have this outfit and addon!")
|
end
|
||||||
print("Process canceled. [".. player:getName() .."] already have outfit: ["..orderItemId.."] with addon: ["..orderCount.."].")
|
table.insert(outfits, itemid)
|
||||||
|
|
||||||
|
for _, outfitId in pairs(outfits) do
|
||||||
|
-- Make sure player don't already have this outfit and addon
|
||||||
|
if not player:hasOutfit(outfitId, orderCount) then
|
||||||
|
db.query("DELETE FROM `znote_shop_orders` WHERE `id` = " .. orderId .. ";")
|
||||||
|
player:addOutfit(outfitId)
|
||||||
|
player:addOutfitAddon(outfitId, orderCount)
|
||||||
|
player:sendTextMessage(MESSAGE_INFO_DESCR, "Congratulations! You have received a new outfit!")
|
||||||
|
print("Process complete. [".. player:getName() .."] has recieved outfit: ["..outfitId.."] with addon: ["..orderCount.."]")
|
||||||
|
else -- Already has outfit
|
||||||
|
player:sendTextMessage(MESSAGE_STATUS_WARNING, "You already have this outfit and addon!")
|
||||||
|
print("Process canceled. [".. player:getName() .."] already have outfit: ["..outfitId.."] with addon: ["..orderCount.."].")
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -47,14 +47,27 @@ function onSay(player, words, param)
|
|||||||
-- ORDER TYPE 5 (Outfit and addon)
|
-- ORDER TYPE 5 (Outfit and addon)
|
||||||
if q_type == 5 then
|
if q_type == 5 then
|
||||||
served = true
|
served = true
|
||||||
-- Make sure player don't already have this outfit and addon
|
|
||||||
if not player:hasOutfit(q_itemid, q_count) then
|
local itemid = q_itemid
|
||||||
db.query("DELETE FROM `znote_shop_orders` WHERE `id` = " .. q_id .. ";")
|
local outfits = {}
|
||||||
player:addOutfit(q_itemid)
|
|
||||||
player:addOutfitAddon(q_itemid, q_count)
|
if itemid > 1000 then
|
||||||
player:sendTextMessage(MESSAGE_INFO_DESCR, "Congratulations! You have received a new outfit!")
|
local first = math.floor(itemid/1000)
|
||||||
else
|
table.insert(outfits, first)
|
||||||
player:sendTextMessage(MESSAGE_STATUS_WARNING, "You already have this outfit and addon!")
|
itemid = itemid - (first * 1000)
|
||||||
|
end
|
||||||
|
table.insert(outfits, itemid)
|
||||||
|
|
||||||
|
for _, outfitId in pairs(outfits) do
|
||||||
|
-- Make sure player don't already have this outfit and addon
|
||||||
|
if not player:hasOutfit(outfitId, q_count) then
|
||||||
|
db.query("DELETE FROM `znote_shop_orders` WHERE `id` = " .. q_id .. ";")
|
||||||
|
player:addOutfit(outfitId)
|
||||||
|
player:addOutfitAddon(outfitId, q_count)
|
||||||
|
player:sendTextMessage(MESSAGE_INFO_DESCR, "Congratulations! You have received a new outfit!")
|
||||||
|
else
|
||||||
|
player:sendTextMessage(MESSAGE_STATUS_WARNING, "You already have this outfit and addon!")
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
13
config.php
13
config.php
@ -999,26 +999,19 @@
|
|||||||
),
|
),
|
||||||
7 => array(
|
7 => array(
|
||||||
'type' => 5,
|
'type' => 5,
|
||||||
'itemid' => 132, // Outfit ID
|
'itemid' => [132, 140], // Outfit ID
|
||||||
'count' => 3, // Addon 0 = none, 1 = first, 2 = second, 3 = both
|
'count' => 3, // Addon 0 = none, 1 = first, 2 = second, 3 = both
|
||||||
'description' => "Nobleman with both addons",
|
'description' => "Noble outfit with both addons",
|
||||||
'points' => 20,
|
'points' => 20,
|
||||||
),
|
),
|
||||||
8 => array(
|
8 => array(
|
||||||
'type' => 5,
|
|
||||||
'itemid' => 140,
|
|
||||||
'count' => 3,
|
|
||||||
'description' => "Noblewoman with both addons",
|
|
||||||
'points' => 20,
|
|
||||||
),
|
|
||||||
9 => array(
|
|
||||||
'type' => 6,
|
'type' => 6,
|
||||||
'itemid' => 32, // Mount ID
|
'itemid' => 32, // Mount ID
|
||||||
'count' => 1,
|
'count' => 1,
|
||||||
'description' => "Gnarlhound mount",
|
'description' => "Gnarlhound mount",
|
||||||
'points' => 20,
|
'points' => 20,
|
||||||
),
|
),
|
||||||
10 => array(
|
9 => array(
|
||||||
'type' => 6,
|
'type' => 6,
|
||||||
'itemid' => 17,
|
'itemid' => 17,
|
||||||
'count' => 1,
|
'count' => 1,
|
||||||
|
23
shop.php
23
shop.php
@ -44,6 +44,14 @@ if ($loggedin === true) {
|
|||||||
$verify = $data['points'];
|
$verify = $data['points'];
|
||||||
if ((int)$old_points == (int)$verify) die("2: Failed to equalize your points.". var_dump((int)$old_points, (int)$verify, $new_points, $expense_points));
|
if ((int)$old_points == (int)$verify) die("2: Failed to equalize your points.". var_dump((int)$old_points, (int)$verify, $new_points, $expense_points));
|
||||||
|
|
||||||
|
// If this is an outfit offer, convert array into an integer.
|
||||||
|
if ($buy['type'] == 5) {
|
||||||
|
if (is_array($buy['itemid'])) {
|
||||||
|
if (COUNT($buy['itemid']) == 2) $buy['itemid'] = ($buy['itemid'][0] * 1000) + $buy['itemid'][1];
|
||||||
|
else $buy['itemid'] = $buy['itemid'][0];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Do the magic (insert into db, or change sex etc)
|
// Do the magic (insert into db, or change sex etc)
|
||||||
// If type is 2 or 3
|
// If type is 2 or 3
|
||||||
if ($buy['type'] == 2) {
|
if ($buy['type'] == 2) {
|
||||||
@ -269,11 +277,22 @@ foreach ($shop_list as $key => $offer) {
|
|||||||
<td>Points:</td>
|
<td>Points:</td>
|
||||||
<?php if ($loggedin === true): ?><td>Action:</td><?php endif; ?>
|
<?php if ($loggedin === true): ?><td>Action:</td><?php endif; ?>
|
||||||
</tr>
|
</tr>
|
||||||
<?php foreach ($category_outfits as $key => $offers): ?>
|
<?php foreach ($category_outfits as $key => $offers):
|
||||||
|
if (!is_array($offers['itemid'])) $offers['itemid'] = [$offers['itemid']];
|
||||||
|
if (COUNT($offers['itemid']) > 2): ?>
|
||||||
|
<tr class="special">
|
||||||
|
<td colspan="2">
|
||||||
|
<p><strong>Error:</strong> Outfit offer don't support more than 2 outfits. <?php echo COUNT($offers['itemid']); ?> configured.
|
||||||
|
<br>[<?php echo implode(',', $offers['itemid']); ?>]</p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<?php endif; ?>
|
||||||
<tr class="special">
|
<tr class="special">
|
||||||
<td><?php echo $offers['description']; ?></td>
|
<td><?php echo $offers['description']; ?></td>
|
||||||
<?php if ($config['show_outfits']['shop']):?>
|
<?php if ($config['show_outfits']['shop']):?>
|
||||||
<td><img src="<?php echo $config['show_outfits']['imageServer']; ?>?id=<?php echo $offers['itemid']; ?>&addons=<?php echo $offers['count']; ?>&head=<?php echo rand(1, 132); ?>&body=<?php echo rand(1, 132); ?>&legs=<?php echo rand(1, 132); ?>&feet=<?php echo rand(1, 132); ?>" alt="img"></td>
|
<td><?php foreach($offers['itemid'] as $outfitId): ?>
|
||||||
|
<img src="<?php echo $config['show_outfits']['imageServer']; ?>?id=<?php echo $outfitId; ?>&addons=<?php echo $offers['count']; ?>&head=<?php echo rand(1, 132); ?>&body=<?php echo rand(1, 132); ?>&legs=<?php echo rand(1, 132); ?>&feet=<?php echo rand(1, 132); ?>" alt="img">
|
||||||
|
<?php endforeach; ?></td>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
<td><?php echo $offers['points']; ?></td>
|
<td><?php echo $offers['points']; ?></td>
|
||||||
<?php if ($loggedin === true): ?>
|
<?php if ($loggedin === true): ?>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user