forked from kaverti/website
This commit is contained in:
parent
c418b301dd
commit
6fc227a413
|
@ -104,7 +104,8 @@ export default {
|
|||
onSale: false,
|
||||
onSalePrice: 0,
|
||||
quantity: 0,
|
||||
price: 100
|
||||
price: 100,
|
||||
description: ''
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -122,7 +123,9 @@ export default {
|
|||
data.append('name', this.item.name);
|
||||
data.append('price', this.item.price);
|
||||
data.append('image', this.item.file);
|
||||
|
||||
data.append('description', this.item.description);
|
||||
data.append('onSale', this.item.onSale);
|
||||
data.append('onSalePrice', this.item.onSalePrice);
|
||||
this.axios.post(process.env.VUE_APP_APIENDPOINT + process.env.VUE_APP_APIVERSION + '/' + 'marketplace/upload/' + this.createType, data)
|
||||
.then((res) => {
|
||||
this.loading = false
|
||||
|
|
|
@ -97,6 +97,15 @@
|
|||
</modal-window>
|
||||
<div class="section">
|
||||
<div class="">
|
||||
<section class="hero is-info">
|
||||
<div class="hero-body" style="padding: 1rem 1rem !important;">
|
||||
<div class="mobile-container">
|
||||
<div class="container">
|
||||
<p style="text-align: center;">Role priorities/orders are coming soon.</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<h1>Roles:</h1>
|
||||
<ul class="list-group mb-2">
|
||||
<draggable
|
||||
|
@ -230,6 +239,15 @@ export default {
|
|||
},
|
||||
saveRoles() {
|
||||
this.updateListSortOrder()
|
||||
Promise.all(
|
||||
this.roles.map(async () => {
|
||||
const response = await this.axios.put(process.env.VUE_APP_APIENDPOINT + process.env.VUE_APP_APIVERSION + `/` + `teams/admin/roles/modify/` + this.$route.params.username, {
|
||||
role: role
|
||||
})
|
||||
const todo = await response.json()
|
||||
console.log(todo.title)
|
||||
})
|
||||
)
|
||||
this.axios.put(process.env.VUE_APP_APIENDPOINT + process.env.VUE_APP_APIVERSION + `/` + `teams/admin/roles/modify/` + this.$route.params.username, {
|
||||
roles: this.roles
|
||||
}).then(() => {
|
||||
|
|
|
@ -398,6 +398,9 @@ module.exports = (sequelize, DataTypes) => {
|
|||
throw Errors.insufficientKoins
|
||||
}
|
||||
}
|
||||
User.prototype.addKoins = function(amount) {
|
||||
this.update({koins: this.koins + amount})
|
||||
}
|
||||
User.prototype.rand = function() {
|
||||
this.update({ emailToken: cryptoRandomString({length: 250})})
|
||||
}
|
||||
|
|
|
@ -0,0 +1,46 @@
|
|||
import bpy
|
||||
def hex_to_rgb(value):
|
||||
gamma = 2.05
|
||||
value = value.lstrip('#')
|
||||
lv = len(value)
|
||||
fin = list(int(value[i:i + lv // 3], 16) for i in range(0, lv, lv // 3))
|
||||
r = pow(fin[0] / 255, gamma)
|
||||
g = pow(fin[1] / 255, gamma)
|
||||
b = pow(fin[2] / 255, gamma)
|
||||
fin.clear()
|
||||
fin.append(r)
|
||||
fin.append(g)
|
||||
fin.append(b)
|
||||
return tuple(fin)
|
||||
bpy.ops.wm.open_mainfile(filepath='C:/Users/matth/Documents/GitHub/website/rendering/avatar.blend')
|
||||
bpy.data.objects['Head'].select = True
|
||||
bpy.data.materials['Head'].diffuse_color = hex_to_rgb('#ffffff')
|
||||
bpy.data.materials['Face'].diffuse_color = hex_to_rgb('#ffffff')
|
||||
bpy.data.objects['Left Arm'].select = True
|
||||
bpy.data.objects['Left Arm'].active_material.diffuse_color = hex_to_rgb('#ffffff')
|
||||
bpy.data.objects['Torso'].select = True
|
||||
bpy.data.objects['Torso'].active_material.diffuse_color = hex_to_rgb('#ffffff')
|
||||
bpy.data.objects['Right Arm'].select = True
|
||||
bpy.data.objects['Right Arm'].active_material.diffuse_color = hex_to_rgb('#ffffff')
|
||||
bpy.data.objects['Left Leg'].select = True
|
||||
bpy.data.objects['Left Leg'].active_material.diffuse_color = hex_to_rgb('#ffffff')
|
||||
bpy.data.objects['Right Leg'].select = True
|
||||
bpy.data.objects['Right Leg'].active_material.diffuse_color = hex_to_rgb('#ffffff')
|
||||
|
||||
face_Image = bpy.data.images.load(filepath = 'C:/Users/matth/Documents/GitHub/website/rendering/global/defaultFace.png')
|
||||
bpy.data.textures['Face'].image = face_Image
|
||||
shirt_Image = bpy.data.images.load(filepath = 'C:/Users/matth/Documents/GitHub/website/rendering/global/2e0a3f219ecfec5964e39b878f77159f.png')
|
||||
bpy.data.textures['Shirt'].image = shirt_Image
|
||||
bpy.data.textures['ShirtR'].image = shirt_Image
|
||||
bpy.data.textures['ShirtL'].image = shirt_Image
|
||||
pants_Image = bpy.data.images.load(filepath = 'C:/Users/matth/Documents/GitHub/website/rendering/global/0.png')
|
||||
bpy.data.textures['PantsR'].image = pants_Image
|
||||
bpy.data.textures['PantsL'].image = pants_Image
|
||||
for obj in bpy.data.objects:
|
||||
obj.select = False
|
||||
bpy.ops.object.select_all(action='SELECT')
|
||||
bpy.ops.view3d.camera_to_view_selected()
|
||||
scene = bpy.context.scene
|
||||
scene.render.image_settings.file_format = 'PNG'
|
||||
scene.render.filepath = 'C:/xampp21/htdocs/marketplace/avatars/a667c109fa1c5584abf4383868307a78.png'
|
||||
bpy.ops.render.render(write_still = 1)
|
|
@ -0,0 +1,46 @@
|
|||
import bpy
|
||||
def hex_to_rgb(value):
|
||||
gamma = 2.05
|
||||
value = value.lstrip('#')
|
||||
lv = len(value)
|
||||
fin = list(int(value[i:i + lv // 3], 16) for i in range(0, lv, lv // 3))
|
||||
r = pow(fin[0] / 255, gamma)
|
||||
g = pow(fin[1] / 255, gamma)
|
||||
b = pow(fin[2] / 255, gamma)
|
||||
fin.clear()
|
||||
fin.append(r)
|
||||
fin.append(g)
|
||||
fin.append(b)
|
||||
return tuple(fin)
|
||||
bpy.ops.wm.open_mainfile(filepath='C:/Users/matth/Documents/GitHub/website/rendering/avatar.blend')
|
||||
bpy.data.objects['Head'].select = True
|
||||
bpy.data.materials['Head'].diffuse_color = hex_to_rgb('#ffffff')
|
||||
bpy.data.materials['Face'].diffuse_color = hex_to_rgb('#ffffff')
|
||||
bpy.data.objects['Left Arm'].select = True
|
||||
bpy.data.objects['Left Arm'].active_material.diffuse_color = hex_to_rgb('#ffffff')
|
||||
bpy.data.objects['Torso'].select = True
|
||||
bpy.data.objects['Torso'].active_material.diffuse_color = hex_to_rgb('#ffffff')
|
||||
bpy.data.objects['Right Arm'].select = True
|
||||
bpy.data.objects['Right Arm'].active_material.diffuse_color = hex_to_rgb('#ffffff')
|
||||
bpy.data.objects['Left Leg'].select = True
|
||||
bpy.data.objects['Left Leg'].active_material.diffuse_color = hex_to_rgb('#ffffff')
|
||||
bpy.data.objects['Right Leg'].select = True
|
||||
bpy.data.objects['Right Leg'].active_material.diffuse_color = hex_to_rgb('#ffffff')
|
||||
|
||||
face_Image = bpy.data.images.load(filepath = 'C:/Users/matth/Documents/GitHub/website/rendering/global/defaultFace.png')
|
||||
bpy.data.textures['Face'].image = face_Image
|
||||
shirt_Image = bpy.data.images.load(filepath = 'C:/Users/matth/Documents/GitHub/website/rendering/global/0.png')
|
||||
bpy.data.textures['Shirt'].image = shirt_Image
|
||||
bpy.data.textures['ShirtR'].image = shirt_Image
|
||||
bpy.data.textures['ShirtL'].image = shirt_Image
|
||||
pants_Image = bpy.data.images.load(filepath = 'C:/Users/matth/Documents/GitHub/website/rendering/global/95f7caf82b3b5f0e43cdc04a9fa4eb8e.png')
|
||||
bpy.data.textures['PantsR'].image = pants_Image
|
||||
bpy.data.textures['PantsL'].image = pants_Image
|
||||
for obj in bpy.data.objects:
|
||||
obj.select = False
|
||||
bpy.ops.object.select_all(action='SELECT')
|
||||
bpy.ops.view3d.camera_to_view_selected()
|
||||
scene = bpy.context.scene
|
||||
scene.render.image_settings.file_format = 'PNG'
|
||||
scene.render.filepath = 'C:/xampp21/htdocs/marketplace/avatars/ffc3d6cedb170c0d080c4729739b2f15.png'
|
||||
bpy.ops.render.render(write_still = 1)
|
|
@ -0,0 +1,46 @@
|
|||
import bpy
|
||||
def hex_to_rgb(value):
|
||||
gamma = 2.05
|
||||
value = value.lstrip('#')
|
||||
lv = len(value)
|
||||
fin = list(int(value[i:i + lv // 3], 16) for i in range(0, lv, lv // 3))
|
||||
r = pow(fin[0] / 255, gamma)
|
||||
g = pow(fin[1] / 255, gamma)
|
||||
b = pow(fin[2] / 255, gamma)
|
||||
fin.clear()
|
||||
fin.append(r)
|
||||
fin.append(g)
|
||||
fin.append(b)
|
||||
return tuple(fin)
|
||||
bpy.ops.wm.open_mainfile(filepath='C:/Users/matth/Documents/GitHub/website/rendering/avatar.blend')
|
||||
bpy.data.objects['Head'].select = True
|
||||
bpy.data.materials['Head'].diffuse_color = hex_to_rgb('#ffffff')
|
||||
bpy.data.materials['Face'].diffuse_color = hex_to_rgb('#ffffff')
|
||||
bpy.data.objects['Left Arm'].select = True
|
||||
bpy.data.objects['Left Arm'].active_material.diffuse_color = hex_to_rgb('#ffffff')
|
||||
bpy.data.objects['Torso'].select = True
|
||||
bpy.data.objects['Torso'].active_material.diffuse_color = hex_to_rgb('#ffffff')
|
||||
bpy.data.objects['Right Arm'].select = True
|
||||
bpy.data.objects['Right Arm'].active_material.diffuse_color = hex_to_rgb('#ffffff')
|
||||
bpy.data.objects['Left Leg'].select = True
|
||||
bpy.data.objects['Left Leg'].active_material.diffuse_color = hex_to_rgb('#ffffff')
|
||||
bpy.data.objects['Right Leg'].select = True
|
||||
bpy.data.objects['Right Leg'].active_material.diffuse_color = hex_to_rgb('#ffffff')
|
||||
|
||||
face_Image = bpy.data.images.load(filepath = 'C:/Users/matth/Documents/GitHub/website/rendering/global/defaultFace.png')
|
||||
bpy.data.textures['Face'].image = face_Image
|
||||
shirt_Image = bpy.data.images.load(filepath = 'C:/Users/matth/Documents/GitHub/website/rendering/global/369a2d7029c093b5b693957f746b5bcb.png')
|
||||
bpy.data.textures['Shirt'].image = shirt_Image
|
||||
bpy.data.textures['ShirtR'].image = shirt_Image
|
||||
bpy.data.textures['ShirtL'].image = shirt_Image
|
||||
pants_Image = bpy.data.images.load(filepath = 'C:/Users/matth/Documents/GitHub/website/rendering/global/0.png')
|
||||
bpy.data.textures['PantsR'].image = pants_Image
|
||||
bpy.data.textures['PantsL'].image = pants_Image
|
||||
for obj in bpy.data.objects:
|
||||
obj.select = False
|
||||
bpy.ops.object.select_all(action='SELECT')
|
||||
bpy.ops.view3d.camera_to_view_selected()
|
||||
scene = bpy.context.scene
|
||||
scene.render.image_settings.file_format = 'PNG'
|
||||
scene.render.filepath = 'C:/xampp21/htdocs/marketplace/avatars/5eb5b0ca51134088662af2e7114b35a5.png'
|
||||
bpy.ops.render.render(write_still = 1)
|
|
@ -0,0 +1,46 @@
|
|||
import bpy
|
||||
def hex_to_rgb(value):
|
||||
gamma = 2.05
|
||||
value = value.lstrip('#')
|
||||
lv = len(value)
|
||||
fin = list(int(value[i:i + lv // 3], 16) for i in range(0, lv, lv // 3))
|
||||
r = pow(fin[0] / 255, gamma)
|
||||
g = pow(fin[1] / 255, gamma)
|
||||
b = pow(fin[2] / 255, gamma)
|
||||
fin.clear()
|
||||
fin.append(r)
|
||||
fin.append(g)
|
||||
fin.append(b)
|
||||
return tuple(fin)
|
||||
bpy.ops.wm.open_mainfile(filepath='C:/Users/matth/Documents/GitHub/website/rendering/avatar.blend')
|
||||
bpy.data.objects['Head'].select = True
|
||||
bpy.data.materials['Head'].diffuse_color = hex_to_rgb('#ffffff')
|
||||
bpy.data.materials['Face'].diffuse_color = hex_to_rgb('#ffffff')
|
||||
bpy.data.objects['Left Arm'].select = True
|
||||
bpy.data.objects['Left Arm'].active_material.diffuse_color = hex_to_rgb('#ffffff')
|
||||
bpy.data.objects['Torso'].select = True
|
||||
bpy.data.objects['Torso'].active_material.diffuse_color = hex_to_rgb('#ffffff')
|
||||
bpy.data.objects['Right Arm'].select = True
|
||||
bpy.data.objects['Right Arm'].active_material.diffuse_color = hex_to_rgb('#ffffff')
|
||||
bpy.data.objects['Left Leg'].select = True
|
||||
bpy.data.objects['Left Leg'].active_material.diffuse_color = hex_to_rgb('#ffffff')
|
||||
bpy.data.objects['Right Leg'].select = True
|
||||
bpy.data.objects['Right Leg'].active_material.diffuse_color = hex_to_rgb('#ffffff')
|
||||
|
||||
face_Image = bpy.data.images.load(filepath = 'C:/Users/matth/Documents/GitHub/website/rendering/global/defaultFace.png')
|
||||
bpy.data.textures['Face'].image = face_Image
|
||||
shirt_Image = bpy.data.images.load(filepath = 'C:/Users/matth/Documents/GitHub/website/rendering/global/0f8593bcc6de77befe75f07ff32148a0.png')
|
||||
bpy.data.textures['Shirt'].image = shirt_Image
|
||||
bpy.data.textures['ShirtR'].image = shirt_Image
|
||||
bpy.data.textures['ShirtL'].image = shirt_Image
|
||||
pants_Image = bpy.data.images.load(filepath = 'C:/Users/matth/Documents/GitHub/website/rendering/global/0.png')
|
||||
bpy.data.textures['PantsR'].image = pants_Image
|
||||
bpy.data.textures['PantsL'].image = pants_Image
|
||||
for obj in bpy.data.objects:
|
||||
obj.select = False
|
||||
bpy.ops.object.select_all(action='SELECT')
|
||||
bpy.ops.view3d.camera_to_view_selected()
|
||||
scene = bpy.context.scene
|
||||
scene.render.image_settings.file_format = 'PNG'
|
||||
scene.render.filepath = 'C:/xampp21/htdocs/marketplace/avatars/213768cddde9ad117e48e5517fda7db2.png'
|
||||
bpy.ops.render.render(write_still = 1)
|
|
@ -158,6 +158,10 @@ router.get('/purchase/:id', auth, async(req, res, next) => {
|
|||
let user = await User.findOne(queryObj2)
|
||||
let inventory = await Inventory.findOne(queryObj3)
|
||||
if (!marketplace) throw Errors.invalidItem
|
||||
let queryObj4 = {
|
||||
where: {id: marketplace.UserId},
|
||||
}
|
||||
let payUser = await User.findOne(queryObj4)
|
||||
if (user.koins < marketplace.price && !marketplace.saleEnabled) {
|
||||
throw Errors.insufficientKoins
|
||||
}
|
||||
|
@ -183,6 +187,8 @@ router.get('/purchase/:id', auth, async(req, res, next) => {
|
|||
const UserId = user.id
|
||||
const priceTotal = marketplace.salePrice
|
||||
await user.removeKoins(priceTotal)
|
||||
await payUser.addKoins(priceTotal)
|
||||
await Transaction.create({UserId: payUser.id, priceOfPurchase: priceTotal, text: user.username + ' purchased your Marketplace item, ' + marketplace.name + ' (' + marketplace.id + ') for ' + priceTotal + ' koins, you have been given ' + priceTotal + ' koins. Your Marketplace item was on sale when this transaction was made.', itemId: marketplace.id, limited: marketplace.limited})
|
||||
await Transaction.create({UserId: UserId, priceOfPurchase: priceTotal, text: user.username + ' purchased ' + marketplace.name + ' (' + marketplace.id + ') from the Marketplace for ' + priceTotal + ' koins', itemId: marketplace.id, limited: marketplace.limited, ipId: Ip.createIfNotExists(req.ip, user)})
|
||||
await Inventory.create({UserId: UserId, purchasePrice: priceTotal, isReselling: false, isResellingPrice: 0, ItemId: marketplace.id, boughtFrom: marketplace.UserId, resellType: 0, auctionId: 0})
|
||||
res.status(200)
|
||||
|
@ -191,6 +197,8 @@ router.get('/purchase/:id', auth, async(req, res, next) => {
|
|||
const UserId = user.id
|
||||
const priceTotal = marketplace.price
|
||||
await user.removeKoins(priceTotal)
|
||||
await payUser.addKoins(priceTotal)
|
||||
await Transaction.create({UserId: payUser.id, priceOfPurchase: priceTotal, text: user.username + ' purchased your Marketplace item, ' + marketplace.name + ' (' + marketplace.id + ') for ' + priceTotal + ' koins, you have been given ' + priceTotal + ' koins.', itemId: marketplace.id, limited: marketplace.limited})
|
||||
await Transaction.create({UserId: UserId, priceOfPurchase: priceTotal, text: user.username + ' purchased ' + marketplace.name + ' (' + marketplace.id + ') from the Marketplace for ' + priceTotal + ' koins', itemId: marketplace.id, limited: marketplace.limited, ipId: Ip.createIfNotExists(req.ip, user)})
|
||||
await Inventory.create({UserId: UserId, purchasePrice: priceTotal, isReselling: false, isResellingPrice: 0, ItemId: marketplace.id, boughtFrom: marketplace.UserId, resellType: 0, auctionId: 0})
|
||||
res.status(200)
|
||||
|
@ -254,7 +262,7 @@ router.post('/upload/:id', auth, limiter, upload.single('image'), async (req, re
|
|||
let img3 = cryptoRandomString({length: 32})
|
||||
let img4 = img3
|
||||
let marketplace = await Item.create({
|
||||
name: req.body.name, UserId: user.id, sourceFile: img, previewFile: img4, limited: req.body.limited, salePrice: req.body.salePrice, saleEnabled: req.body.saleEnabled, price: req.body.price, quantityAllowed: req.body.quantityAllowed, approved: false, ItemCategoryId: findCategory.id, description: req.body.description
|
||||
name: req.body.name, UserId: user.id, sourceFile: img, previewFile: img4, limited: req.body.limited, salePrice: req.body.onSalePrice, saleEnabled: req.body.onSale, price: req.body.price, quantityAllowed: req.body.quantityAllowed, approved: false, ItemCategoryId: findCategory.id, description: req.body.description
|
||||
})
|
||||
if(marketplace.ItemCategoryId === 0) {
|
||||
var type = "hat"
|
||||
|
|
|
@ -517,6 +517,85 @@ router.put('/roles/modify/:username/:id', auth, async(req, res, next) => {
|
|||
} catch (e) { next(e) }
|
||||
})
|
||||
|
||||
router.put('/roles/modify/:username', auth, async(req, res, next) => {
|
||||
try {
|
||||
let team = await Team.findOne({
|
||||
where: {username: req.params.username}
|
||||
});
|
||||
let isAuthMem = await TeamMembers.findOne({
|
||||
where: {UserId: req.userData.UserId, TeamId: team.id}
|
||||
});
|
||||
if(!isAuthMem) {
|
||||
throw Errors.notInTeam
|
||||
}
|
||||
let isAuthRole = await TeamMemberRole.findOne({
|
||||
where: {UserId: req.userData.UserId, TeamId: team.id}
|
||||
})
|
||||
let isAuth1 = await TeamRoles.findOne({
|
||||
where: {id: isAuthRole.RoleId, administrator: true}
|
||||
})
|
||||
let isAuth2 = await TeamRoles.findOne({
|
||||
where: {id: isAuthRole.Role2Id, administrator: true}
|
||||
})
|
||||
let isAuth3 = await TeamRoles.findOne({
|
||||
where: {id: isAuthRole.Role3Id, administrator: true}
|
||||
})
|
||||
let isAuth4 = await TeamRoles.findOne({
|
||||
where: {id: isAuthRole.Role4Id, administrator: true}
|
||||
})
|
||||
let isAuth5 = await TeamRoles.findOne({
|
||||
where: {id: isAuthRole.Role5Id, administrator: true}
|
||||
})
|
||||
let isAuth6 = await TeamRoles.findOne({
|
||||
where: {id: isAuthRole.Role6Id, administrator: true}
|
||||
})
|
||||
let isAuth7 = await TeamRoles.findOne({
|
||||
where: {id: isAuthRole.Role7Id, administrator: true}
|
||||
})
|
||||
let isAuth8 = await TeamRoles.findOne({
|
||||
where: {id: isAuthRole.Role8Id, administrator: true}
|
||||
})
|
||||
let isAuth9 = await TeamRoles.findOne({
|
||||
where: {id: isAuthRole.Role9Id, administrator: true}
|
||||
})
|
||||
let isAuth10 = await TeamRoles.findOne({
|
||||
where: {id: isAuthRole.Role10Id, administrator: true}
|
||||
})
|
||||
const allowArray = [
|
||||
isAuth1,
|
||||
isAuth2,
|
||||
isAuth3,
|
||||
isAuth4,
|
||||
isAuth5,
|
||||
isAuth6,
|
||||
isAuth7,
|
||||
isAuth8,
|
||||
isAuth9,
|
||||
isAuth10
|
||||
]
|
||||
let otherThanNull = allowArray.some(function (el) {
|
||||
return el !== null;
|
||||
});
|
||||
if(team && otherThanNull) {
|
||||
let queryObj3 = {
|
||||
where: {userId: req.userData.UserId, teamId: team.id},
|
||||
}
|
||||
if(team.banned) {
|
||||
res.status(200)
|
||||
res.json({success: false})
|
||||
}
|
||||
let teamJoinTest = await TeamMembers.findOne(queryObj3)
|
||||
if (teamJoinTest) {
|
||||
let updateRoles = await TeamRoles.bulkCreate(req.body.roles, { updateOnDuplicate: ["id"] })
|
||||
res.status(200)
|
||||
res.json(updateRoles)
|
||||
}
|
||||
} else {
|
||||
throw Errors.teamDoesNotExist
|
||||
}
|
||||
} catch (e) { next(e) }
|
||||
})
|
||||
|
||||
router.put('/members/modify/:username/:id', auth, async(req, res, next) => {
|
||||
try {
|
||||
let team = await Team.findOne({
|
||||
|
|
Loading…
Reference in New Issue